Skip to content

Instantly share code, notes, and snippets.

View shahab570's full-sized avatar

MD SHAHAB UDDIN shahab570

View GitHub Profile
let country =["USA","CANADA","GERMANY"];
let [usa,...other] = country;
console.log(usa); //USA
console.log(other); //["CANADA","GERMANY"];
let country =["USA","CANADA","GERMANY"];
let [usa,...other] = country;
console.log(usa); //USA
console.log(other); //["CANADA","GERMANY"];
const first ={name: "john"};
const second ={age: 30};
const coord ={...first,...second};
console.log(coord); // {name: "john",age: 30};
let first = [1,2,3,4];
let second = [...first];
console.log(second); //[1,2,3,4]
let x = [1,2,3];
let y = [4, 5,6];
console.log([...x,...y]); ///[1,2,3,4,5,6]
var str = "Football";
var arr =[1,2,3];
console.log(...str); // F o t b a l l
console.log(...arr); // 1 2 3
var x =[1,2,3];
console.log(x); //[1,2,3]
console.log(...x); //1 2 3
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");
});
};
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
})
@shahab570
shahab570 / sel.js
Created January 1, 2021 12:14
dd.js
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
},