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
| function Doctor(name, surname) { | |
| this.name = name; | |
| this.surname = surname; | |
| this.father = null; | |
| } | |
| var Mikel = new Doctor("Mikel", "Jordan"); | |
| var Russel = new Doctor("Russel", "Domingo"); | |
| Mikel.father = Russel; |
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
| function information({ | |
| name = "Mickel", | |
| age = 50, | |
| country = "USA", | |
| state = "New York", | |
| }) { | |
| console.log(name, age, country, state); | |
| } | |
| var person = { | |
| name: undefined, |
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
| function information({ name, age, country, state }) { | |
| console.log(name, age, country, state); | |
| } | |
| var person = { | |
| name: "John Doe", | |
| age: 30, | |
| country: "USA", | |
| state: "New York", | |
| }; | |
| information(person); //John Doe 30 USA New York |
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
| let USA = { | |
| city: { | |
| chicago: "Beautiful", | |
| Houston: "Charming", | |
| }, | |
| press: ["CNN", "Fox"], | |
| president: "Donald Trump", | |
| }; | |
| let { |
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
| let x, y, z; | |
| ({ x, y, z } = { x: 100, y: 200, z: 300 }); | |
| console.log(x); //100 | |
| console.log(y); //200 | |
| console.log(z); //300 |
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
| let information = { | |
| firstName: "John", | |
| lastName: "Doe", | |
| city: "New York", | |
| }; | |
| let { firstName, ...last } = information; | |
| console.log(last.lastName); //Doe | |
| console.log(last.city); //New York |
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
| let information = { | |
| firstName: "John", | |
| lastName: "Doe", | |
| city: "New York", | |
| }; | |
| let { firstName: f, city: c } = information; | |
| console.log(f); //John | |
| console.log(c); //New York |
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
| let information = { | |
| firstName: "John", | |
| lastName: "Doe", | |
| city: "New York", | |
| }; | |
| let { firstName, city } = information; | |
| console.log(firstName); //John | |
| console.log(city); //New York |
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
| const x = { | |
| name: "John", | |
| age: 52, | |
| }; | |
| for (var [key, value] of Object.entries(x)) { | |
| console.log(key + " " + value); | |
| } |
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
| let user = {}; | |
| [user.name,user.surname] = "john Doe".split(" "); | |
| console.log(user.name); //john | |
| console.log(user.surname); //Doe |