What's Promise? |
Sample code |
Let's create an empty object project and add a few fields with values.
Now, we need to access level property in the object through assigning a variable . |
var project = {
level: 2, difficulty: "Expert" }; var accessLevel = Object.create(project); console.log(accessLevel.level); var project2 = { gameName: "WOW", gameMaker: "Eternal Gaming", tries: 4 } var game = Object.create(project2); console.log(game.gameName); console.log("You are on " + accessLevel.level + " level while playing " + game.gameName); console.log(accessLevel.level + game.tries); console.log(typeof game); console.log(typeof game.toString); |