Introduction to the use of common functions in javascript

  • 2020-03-30 01:00:52
  • OfStack

 
<html> 
<head> 
<title>javascript The use of ordinary functions in </title> 

<script> 
function show(){ 
document.write("show The function is called " + "<br/>"); 
return 10; 
} 

var hello = show();//The show() function is called, assigning the return value to the hello variable. If the function does not return a value, it returns undefined
document.write(hello + "<br/>");//10 

var hello2 = show;//Show and hello2 point to the same function
document.write(hello2 + "<br/>");//Print out the body of the show function

hello2();//This is equivalent to calling the show () function

</script> 

</head> 
<body> 

</body> 
</html> 

Related articles: