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 size = (x, y) => { | |
return [x, y]; | |
}; | |
const [width, height] = size("50", "100"); | |
console.log(width); //50 | |
console.log(height); //100 |
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
import * as myAdds from 'adds' |
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
import { addOne, example } from 'adds' |
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
import { addOne, addTwo } from 'adds' |
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
import { addTwo } from 'adds' | |
addTwo(2) // 4 |
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
export let example = “A variable” |
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
export function addOne(x) { | |
return x + 1 | |
} | |
export function addTwo(x) { | |
return x + 2 | |
} |
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
export function addTwo(x) { | |
return x + 2; | |
} |
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 printAfterTimeout(string, timeout){ | |
return new Promise((resolve, reject) => { | |
setTimeout(function(){ | |
resolve(string); | |
}, timeout); | |
}); | |
} | |
printAfterTimeout('Hello ', 2e3).then((result) => { | |
console.log(result); |
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 printAfterTimeout(string, timeout, done){ | |
setTimeout(function(){ | |
done(string); | |
}, timeout); | |
} | |
printAfterTimeout('Hello ', 2e3, function(result){ | |
console.log(result); | |
// nested callback | |
printAfterTimeout(result + 'Reader', 2e3, function(result){ |