What is the difference between an object create with this syntax: { prop1: val1, prop2: val2 }
, and an object created with this syntax: { 'prop1': val1, 'prop2': val2 }
?
And also, does the following code work?
var val1 = 10, val2 = 15;
var tmp1 = { prop1: val1 };
var tmp2 = { 'prop2': val2 };
alert(tmp1['prop1']); // I expect 10
alert(tmp2['prop2']); // I expect 15
P.S.: Sorry, I couldn't come up with a better title for my question. That reflects my lack of knowledge of JavaScript.