Why doesn't this eval call alert("Summer")?
eval('(caption="Summer";alert(caption))');
Does it have something to do with the quotes in "Summer"?
Why doesn't this eval call alert("Summer")?
eval('(caption="Summer";alert(caption))');
Does it have something to do with the quotes in "Summer"?
Uncaught SyntaxError: Unexpected token ;
The outer parentheses make no syntactical sense. Try this:
eval('caption="Summer";alert(caption)');
(alert("foo"), alert("bar"), window.foo = "bar", 1, 2 ,3) will evaluate all grouped expressions but only return 3. So (@Aistina) the correct answer would be that the semicolon inside the parantheses makes no syntactical sense: eval('(caption="Summer",alert(caption))');A more better way to do this and avoid syntax problem is to do following,
eval(function(){var x="test"; alert(x)}());
,operator:eval('(caption="Summer",alert(caption))');