Promises in JavaScript
Code : // resolve // reject // pending console . log ( "We are at tutorial 39b" ); // Pretend that this response is coming from the server const students =[ { name : "Ram" , subject : "JavaScript" }, { name : "Rohan" , subject : "Machine Learning" } ] function enrollStudent ( student ){ return new Promise ( function ( resolve , reject ){ setTimeout ( function (){ students . push ( student ); console . log ( "Student has been enrolled" ); const error = false ; ...