(0, eval) ("1mm 1") A passing Daniel will explain why this line of code can be written in this way. What do you mean?

came across a code like this today:

(0, eval)( "1+1" );    //2

so I copied one:

( 0, function( a ) {
    console.log( a );        //"hello world"
} )( "hello world" );

( function( a ) {
    console.log( a );        //
}, function( b ) {
    console.log( b );        //"hello world"
} )( "hello world" );

instant? Fly by, which god can explain?

May.03,2021

you have to understand what a comma means
https://developer.mozilla.org.
is the last to be valid


1. One of the uses of parentheses is to execute one or more expressions and return the value of the last expression, which requires a comma between multiple expressions. "separate
example: (1 code >) / / the code is executed at once, and finally 6 is used as the return value
2. Execute the anonymous function (function () {}) ()
, so you can think of this as equal to (eval) ('1cm 1')
again equal to eval (' 1th 1')

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-1e50a10-450b7.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-1e50a10-450b7.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?