JSFiddle - React, Tailwind, and code Playground
by mnk
JavaScript
// Get requestValue result and console.log it
// should equal 22
// Don't edit this
const calculateTheValue = (valueA, valueB) => valueA + valueB;
// Edit anything below with the following constraints:
// - calculateTheValue must be called within a setTimeout
// - You must assert the result of calculateTheValue (22) outside the setTimeout
// The sample code below is meant to showcase the logic we want, and does not represent working code.
const getTheValue = (x) => {
const y = 12;
setTimeout(function () {
calculateTheValue(x, y);
}, 1000);
}
const requestValue = () => {
getTheValue(10);
}
console.assert(requestValue() === 22);