Inscrivez-vous ou connectez-vous pour rejoindre votre communauté professionnelle.
with Create a new object with the specified prototype object and properties can be created
with object.create() you can initialize the object with your own default value (scripted in the create function) while in new object() properties cannot be set while creating instance and you have to set properties later. See examples below:
Creating a Direct Instance:
person=new Object();
person.firstname="John";
person.lastname="Doe";
person.age=50;
person.eyecolor="blue";
Using an create Constructor:
function create(firstname,lastname,age,eyecolor)
{
this.firstname=firstname;
this.lastname=lastname;
this.age=age;
this.eyecolor=eyecolor;
}