Created
March 29, 2016 19:17
-
-
Save parthdesai93/dd9d6101968ec8f05615ff2d7969f87b to your computer and use it in GitHub Desktop.
a ‘dog’ object has the value of legs = 4. Create a new var named ‘fido’ as a ‘dog’ object. Set fido’s age as ‘3’ and output the number of legs that ‘fido’ has.
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 dog = { | |
legs: 4 | |
}; | |
var fido = Object.create(dog); | |
fido.age = 3; //can define fido['age'] = 3; as well | |
console.log('Fido has : ' + fido.legs + ' legs!'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment