Home >Web Front-end >JS Tutorial >Some views on JavaScript_javascript skills
As we all know, a JS code that ends with a semicolon or a carriage return will run normally in the browser (at least in my IE7). I don’t know if this is a feature of the JS language or just a fault-tolerant function of the interpreter? Since the carriage return character can also be a sign of the end of a code, it is more troublesome when compressing JS. To compress all carriage returns, the program needs to know where the end of a statement is and add ";" after the end position. This is not an easy thing (maybe there is an easy way that I haven't thought of yet). In the end, I had to adopt a compromise method: retain the necessary carriage return characters and remove the ";", ",", " " and so on before and after the carriage return character separator. (How easy it would be if JS ended with ";" like C and other languages!)
During the development process, I also discovered a strange problem. As shown in the following code: