5 ms·
Can you elaborate on this? I tried that and got "unexpected identifier" as a console error. Not sure how it works.
by aetch 12y ago
Can you elaborate on this? I tried that and got "unexpected identifier" as a console error. Not sure how it works.
- tautvidas 12y agoThe point is to break out of the startTimer() function call, e.g.: startTimer('');foo();//'); The remaining '); can be commented out in order to not create any syntax errors.
- lazyjones 12y agoSPOILER ALERT I used this: 1'* alert()* ' (without the spaces needed for markdown here)
- rhubarbcustard 12y agoCould you explain why the * works in there?
- lazyjones 12y agoJS does automatic type conversion in this case, so it's syntactically correct to multiply a string with a number (or function result). We're just interested in the side-effects of alert(), so it doesn't really matter what kind of expression we use it in, as long as it parses correctly and causes alert() to be executed (evaluated).
- mariocarvalho 12y agoNice!