object properties js code example
Example 1: javascript list object properties
var person={"first_name":"Bill","last_name":"Jenner"}
var keys = Object.keys(person);
Example 2: how to create object js
function person(fname, lname, age, eyecolor){
this.firstname = fname;
this.lastname = lname;
this.age = age;
this.eyecolor = eyecolor;
}
myFather = new person("John", "Doe", 50, "blue");
document.write(myFather.firstname + " is " + myFather.age + " years old.");
Example 3: object literal javascript
var myObject = {
sProp: 'some string value',
numProp: 2,
bProp: false
};