Last active
August 29, 2015 13:57
-
-
Save robynitp/9652665 to your computer and use it in GitHub Desktop.
A basic Javascript object literal
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var employee = { | |
name: 'Jane', | |
dob: '04-09-80', | |
position: 'Art Director', | |
start_date: '10-14-2011', | |
subordinates: ['Jack','Jill','Edward'], | |
work: function(){ | |
console.log('I make stuff'); | |
}, | |
employee_id: 23452 | |
}; | |
// output the employee's name | |
alert(employee.name); | |
// call the function that's stored in the work property | |
employee.work(); | |
// output all the names in the subordinates array | |
for (var i=0;i<employee.subordinates.length;i++){ | |
console.log(employee.subordinates[i]); | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment