javascript - Why this code is valid: "(1,eval)('this')" -


why next code valid javascript code?

var global = (1,eval)('this');  alert(global); 

that's because comma operator returns second operand (and evaluates both).

the code in question equivalent to:

1; var global = eval('this'); alert(global); 

Comments

Popular posts from this blog

delphi - How to convert bitmaps to video? -

jasper reports - Fixed header in Excel using JasperReports -

python - ('The SQL contains 0 parameter markers, but 50 parameters were supplied', 'HY000') or TypeError: 'tuple' object is not callable -