return vs console.log
- New developers often get confused between
return
andconsole.log
return
tells the caller function the result of a function- Useful when you want to use the result of a calculation
console.log
makes a logging record of a message- Useful for debugging and seeing if something happened
- Only useful to a developer. Not visible to a normal user
15 / 24