copy properties from one object to other in JavaScript

JavaScript

🤖 Code Explanation

/* ************************* */
/* ************************* */
/* ************************* */

//What is the result of this code?

for (var i = 0; i < 5; i++) {
setTimeout(function() { console.log(i); }, i * 1000 );
}

The result of this code is 5, 5, 5, 5, 5.

Download SpellBox today