+ 1

Need some brief explanation on return statement in JavaScript...if it is used for printing the answer onto the screen?!!

16th May 2020, 2:31 PM
✨ Muviee ✨
✨ Muviee ✨ - avatar
2 Respuestas
+ 4
it is used to return a value after a certain operation (this can be a math operation, API call, etc) function sum(a,b) { return a+b; } console.log(sum(4,3)); if you call sum(4,3) you get 7. if there was no return statement you wouldn't get a value back and console.log(sum(4,3)) wouldn't print anything
16th May 2020, 2:40 PM
Sebastian Pacurar
Sebastian Pacurar - avatar
+ 1
Well thanq...😇
16th May 2020, 2:42 PM
✨ Muviee ✨
✨ Muviee ✨ - avatar