javascript - A function with a console log output inside console.log prints undefined -
function haha(){ console.log('haha'); } console.log(haha()); prints:
haha undefined is because if don't specify return in function return undefined , second console.log outputting?
it returns undefined because function doesn't return anything.
you e.g. return "haha" string or whatever like.
function haha(){ console.log('haha'); return 'haha'; } console.log(haha());
Comments
Post a Comment