I'm asked by an interviewer, is there a difference between the following code:
var o1 = {
a: 1,
b: 2,
c: 3
}
for( var p in o1) {
// ...
}
vs
var o2 = new Object()
o2.a = 1;
o2.b = 2;
o2.c = 3;
for( var p in o2) {
// ...
}
I can't think of any difference, is there any??