Skip to content

Instantly share code, notes, and snippets.

View woliveiras's full-sized avatar
🤖
Always typing code

William Oliveira woliveiras

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