运行 ❯
获取您
自己的
网站
×
更改方向
保存代码
更改主题,深色/浅色
前往 Spaces
<!DOCTYPE html> <html> <body> <h2>JavaScript Functions</h2> <p>Functions can be treated as values:</p> <p>x = myFunction(4,3) or x = 12</p> <p>In both cases, x becomes a number with the value of 12.</p> <p id="demo"></p> <script> function myFunction(a, b) { return a * b; } let x = myFunction(4, 3); document.getElementById("demo").innerHTML = x; </script> </body> </html>