The string statement passed in the string function will report an error without a semicolon.

var str = "console.log("222");console.log(111)";  //
var tempFun = new Function(str);
tempFun();   

then I remove the semicolon between the two sentences

var str = "console.log("222") console.log(111)";  //
var tempFun = new Function(str);
tempFun();   

I don"t quite understand why we can write without a semicolon.

Jun.29,2021

does not add a semicolon, but there is an enter


the following must report an error, you have multiple lines of code here, so you must add a semicolon ";" mark the end, otherwise, the implementation will definitely report a syntax error.


I'm afraid you're crazy.
by not adding a semicolon, we mean the end of the line ah

.
//
console.log('222')console.log(111)console.log(111)
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b3f212-2bbe5.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b3f212-2bbe5.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?