Hello, the tutorial for some object lesson says this: When you use the constructor, the syntax looks like this: Here is example of constructor syntax:
var myObj = new Object();
You can add keys to your object after you've created it in two ways:
myObj["name"] = "Charlie"; myObj.name = "Charlie";
Both are correct, and the second is shorthand for the first.
I tried putting constructor shorthand into practice with this made up example(I always do my own practice drills with new spots):
var rock = newObject(); rock.name = "meteorite"; rock.age = 45,000,000; rock.size = "very large"; rock.color = "orange"; console.log(rock);
When I attempt to run the code, I get object not defined. Can someone give a little more on Shorthand and constructor please?