Hey Coders, I was wondering what is the difference beteen 'return' and 'cosole.log'?


#1


Replace this line with your code.


#2

The return statement stops the execution of a function and returns a value from that function.

console.log() - method to display data in browser console.


#3

return returns a value to be used but stops executing codes after it inside that function. console.log forces you to print it. so if you wanna value you wanna return but not print it right away, you'll use return


#4

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.