Back
Close

JavaScript promises, mastering the asynchronous

Magus
455.2K views

It's time to test if you are really listening. 😉

What are 2 native functions to run code asynchronously in JavaScript ?
let fs = require('fs');

console.log('1');

fs.readFile('test.txt', 'utf8', function(error, data) {
    if (error) {
         throw error;
    }

    console.log('2');
});

console.log('3');
What is the output of the code above?
What is the function to stop an interval timer?
Create your playground on Tech.io
This playground was created on Tech.io, our hands-on, knowledge-sharing platform for developers.
Go to tech.io