google chrome - Why is this Javascript syntax illegal? -


both chrome , safari report illegal. report "unexpected token 'this'" pointing @ 'this.b'. here minimum code needed show problem:

function x(){ this.a = function() {} this.b = function() {}  } 

it happens if 2 declarations on same line. ideas? looks legal me.
it's annoying because comes out of javascript minifier.

javascript automatically insert semi-colons on new lines. missing here original semi-colons delimit end of statement.

insert semicolons after closing braces proper js , work fine.


Comments