Home >Web Front-end >Front-end Q&A >How to calculate the product in JavaScript
How to implement quadrature in JavaScript: 1. Create a pro method through function and define two parameters; 2. Calculate the product of two parameters through "x*y"; 3. Output the result through the console and check it out.
The operating environment of this article: windows7 system, css3 version, Dell G3 computer.
How to calculate the product in JavaScript?
It’s very simple. We know what the arithmetic operators of JavaScript are. You can look at the following table:
Then we create it directly A function that can implement multiplication and product:
The code is as follows:
function pro(x,y){ return x*y; } var ji=pro(67,12); console.log(ji);
This should be very simple!
Recommended study: "javascript basic tutorial"
The above is the detailed content of How to calculate the product in JavaScript. For more information, please follow other related articles on the PHP Chinese website!