Skip to content

Instantly share code, notes, and snippets.

View eshaan5's full-sized avatar

Eshaan Bagga eshaan5

View GitHub Profile
const promise = checkWeather('Delhi');
checkWeather('Delhi', (weather) => {
if (weather === 'well') {
return checkFlights('Mumbai', (flights) => {
buyTicket(flights[0], (ticket) => {
console.log('ticket no. %d', ticket.number);
});
});
}
console.log('the weather is bad');
const makeBurger = nextStep => {
getPotato(function (potato) {
cookPotato(potato, function (cookedPotato) {
getBuns(function (buns) {
putPattyBetweenBuns(buns, potato, function(burger) {
nextStep(burger)
})
})
})
})
const makeBurger = () => {
getPotato(function(potato) {
cookPotato(potato, function(cookedPotato) {
getBuns(function(buns) {
putPattyBetweenBuns(buns, potato, function(burger) {
// Serve the burger
});
});
});
});
const makeBurger = () => {
getPotato(function(potato) {
cookPotato(potato, function(cookedPotato) {
getBuns(function(buns) {
// Put patty in bun
});
});
});
};
const makeBurger = () => {
getPotato(function(potato) {
// We can only cook potato after we get it.
});
};
const makeBurger = () => {
const potato = getPotato();
const patty = cookPotato(potato);
const buns = getBuns();
const burger = putPattyBetweenBuns(buns, patty);
return burger;
};
const burger = makeBurger();
serve(burger);
console.log('Learning')
setTimeout(function() {
console.log('Asynchronous')
}, 5000)
console.log('JavaScript')
/* Output:
console.log('Learning')
console.log('Asynchronous')
console.log('JavaScript')
/* Output:
Learning
Asynchronous
"start": "webpack-dev-server --mode development --hot --open",