What do you think the following code does?
function fn(msg, time) {
setTimeout(function() {
console.log(msg);
}, time);
}
fn('it works', 1000);
What do you think the following code does?
function fn(num) {
return (num > 3) ? 'TOO BIG' : num;
}
console.log([ 1, 2, 3, 4, 5 ].map(fn));
What do you think the following code does?
function fn(num, range) {
for (var i = 1; i <= range; i += 1) {
console.log((num % i) ? 'not divisible by' : 'divisible by', i);
}
}
fn(200, 10);
<deleted because the point is not to post the answers here>