Can any one tell me why console.log(typeof countup(5)); returns a object and
console.log(typeof countdown)returns a function
Can any one tell me why console.log(typeof countup(5)); returns a object and
console.log(typeof countdown)returns a function
the function returns an array wich is a kind of object, so typeof countup(5)
reflects that
if you write countdown
you are not calling the function, it is just a reference to the function, so typeof countdown
is correctly saying that countdown
is a function - you are not calling it as in the other case, so you are not checking the type of the returned value