Sunday, March 23, 2014

Ghost Javascript syntax error

Something like this will break javascript compilers although it is theoretically valid code:

function lala()
{
    var o;
    o.afunction=function()
    {}if(o) return;
}

I simplified it to get to the crux of the problem; putting a semicolon or a new line right before the "if" fixes it.

No comments:

Post a Comment