Defining Objects
Jump to navigation
Jump to search
var john = { name: 'John', lastName: 'Smith', yearOfBirth: 1990, job: 'Teacher', isMarried: false, family: ['jane', 'mark'], calculateAge: function(yob) { return 2016 - yob; } }; console.log(john.calculateAge(1990));
Loop through items
for(var item in john ){ console.log(item + " - " + john [item]);