I’m learning JavaScript, and want to understand this behavior.
I was studying the following code:
function multiNum(x,y){
return x*y
}
var num = multiNum(3,4);
document.write(num)
I tried to type this myself, and this is what I came up with:
function multiNum(x,y){
return x*y
}
document.write(multiNum(3,4))
I thought I could put multiNum(3,4) into the document.write() instead of making another variable.
So, is it just a rule that I have to create another variable and put the new one into document.write()?