My javascript code works with arrow function but not with normal function
//NORMAL FUNCTION (not working)
function multiplier(factor) {
return function (number) {
number * factor;
}
}
const twice = multiplier(2);
console.log(twice(5));
//ARROW FUNCTION (working)
function multiplier(factor) {
return number => number * factor;
}
const twice = multiplier(2);
console.log(twice(5));
Thanks