If I write in Javascript :
var o= { aaa :s };
How does he know to distiguish between
1) label named aaa

2) property named aaa ( IMHO , properties can be used without ")
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Put simply:
… and the JavaScript parser knows what it is parsing at any given point in the code.
It gets a little more complex when you have (for example) a function as the value of a property, but it basically comes down to parse modes. At that point the stack of things being parsed would have a function on top and the object literal below it. The object literal parsing wouldn’t become “active” again until the function was finished.
A detailed example of how to parse HTML is provided in the HTML 5 specification. The principles are basically the same for JavaScript.