Objects


#1

an example was given to us on how to construct objects- I understand the concept but, in this example given to us, I don't know why "var emptyObj = {};" was listed at the end.?
Thanks in advance

var myObj = {
type: 'fancy',
disposition: 'sunny'
};

var emptyObj = {};


#2

Hi I think that its just there to show you how a empty object is made with that object literal notation.


#3

Sorry could you be clearer?


#4

That's how you make objects, with ˙{}˙. So emptyObj is an object, but without any given values.


#5

So here when they aske you to creat a an object there are two anotation :
the first one is that

var myObj = {
    type: 'fancy',
    disposition: 'sunny'
};

and if they aske you to creat a empty object you wil writte it like that

var MyObj = {};

and the second anotation

var me = new Object();
    me.name = "Franck";
    me.age = 180;

and if tehy aske youto do a empty object with that anotation its look like that

var myObj = new Object();