+ 1
Need some brief explanation on return statement in JavaScript...if it is used for printing the answer onto the screen?!!
2 Answers
+ 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
+ 1
Well thanq...đ