Oh sorry. Here is the link: repl.it/@doHoangKhanh121/StrikingU...
So in this program we're not receiving results or returning anything. We're only printing to the terminal because we use console.log.
console.log
Printing to the terminal and returning a result are separate things. One uses console.log and the other uses return.
return
In this program, we print to the screen on line 7 where we have console.log(${num} * ${i} = ${num * i})
${num} * ${i} = ${num * i}
But we never return anything, so on line 17, if we do:
const result = callback(); // this will always be undefined because we're not returning anything from inside callback()
For an example of how return works please see my previous reply :).
Hope that helps :)
Yep. That really helps me to know more about "return" in function. Thank you very much 🤗
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Oh sorry. Here is the link: repl.it/@doHoangKhanh121/StrikingU...
So in this program we're not receiving results or returning anything. We're only printing to the terminal because we use
console.log
.Printing to the terminal and returning a result are separate things. One uses
console.log
and the other usesreturn
.In this program, we print to the screen on line 7 where we have console.log(
${num} * ${i} = ${num * i}
)But we never return anything, so on line 17, if we do:
For an example of how
return
works please see my previous reply :).Hope that helps :)
Yep. That really helps me to know more about "return" in function. Thank you very much 🤗