This file contains 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 country =["USA","CANADA","GERMANY"]; | |
let [usa,...other] = country; | |
console.log(usa); //USA | |
console.log(other); //["CANADA","GERMANY"]; |
This file contains 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 country =["USA","CANADA","GERMANY"]; | |
let [usa,...other] = country; | |
console.log(usa); //USA | |
console.log(other); //["CANADA","GERMANY"]; |
This file contains 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 first ={name: "john"}; | |
const second ={age: 30}; | |
const coord ={...first,...second}; | |
console.log(coord); // {name: "john",age: 30}; |
This file contains 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 first = [1,2,3,4]; | |
let second = [...first]; | |
console.log(second); //[1,2,3,4] |
This file contains 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 = [1,2,3]; | |
let y = [4, 5,6]; | |
console.log([...x,...y]); ///[1,2,3,4,5,6] |
This file contains 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 str = "Football"; | |
var arr =[1,2,3]; | |
console.log(...str); // F o t b a l l | |
console.log(...arr); // 1 2 3 |
This file contains 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 x =[1,2,3]; | |
console.log(x); //[1,2,3] | |
console.log(...x); //1 2 3 |
This file contains 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 check_files = function () { | |
return new Promise((resolve, reject) => { | |
resolve("I checked files, "); | |
}); | |
}; | |
let make_calls = function (message) { | |
return new Promise((resolve, reject) => { | |
resolve(message + "," + "I made all important calls"); | |
}); | |
}; |
This file contains 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 new_car = new Promise((resolve, reject) => { | |
setTimeout(() => { | |
resolve("This is the car.Enjoy!!!"); | |
}, 3000); | |
}); | |
new_car | |
.then((value) => { | |
alert(value); //ths code runs because promise resolves | |
}) |
This file contains 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 new_car = new Promise((resolve, reject) => { | |
setTimeout(() => { | |
resolve("This is the car.Enjoy!!!"); | |
}, 3000); | |
}); | |
new_car.then( | |
(value) => { | |
alert(value); //ths code runs because promise resolves | |
}, |