Return Statement
abhiraj (0)

The return statement doesn't print anything in the repl's console, while it does in my browser's console. So, what's wrong with the repl's console?

https://repl.it/@abhiraj/return-statement-test

Check script.js, thanks!

You are viewing a single comment. View All
barrycarter (12)

return isn't supposed to print anything. You need to console.log the result, at least.

abhiraj (0)

@barrycarter It should return (in the console) whatever has been returned through the code? no?

Vandesm14 (1224)

@abhiraj No. Your browser's console is equipped with debugging capabilities, which catch return statements. So console.log would work on both.

barrycarter (12)

As @Vandesm14 notes, your browser may be configured to show the result of return() statements, but, in general, return doesn't print anything.