Don't understand why you should not use an object literal at the beginning of a statement
问题 Just reading some of the JS tuts on Mozilla and came across the statement "You should not use an object literal at the beginning of a statement. This will lead to an error or not behave as you expect, because the { will be interpreted as the beginning of a block." I don't understand what they mean. Could someone shed some light on this please 回答1: An object literal starts with { { name: "Paul" age: 30 } // I wish But so does a block. { if (age < 30) console.log ("He's lying again"); } When