function func(n1) {
const foo = n2 => func(n1 + n2)
foo.toString = () => n1
return foo;
}
const fo = func(3)
console.log(fo(10))
This is my solution for a Codewars kata. Codewars wanted me to return a number and it actually returns a number in Codewars and Codepen also. But when I paste it to the browser console I get the foo function, not a number.
Why does this happen? What's the difference between Copeden console and browser console? And how do I return a number in browser console?