Home >Web Front-end >Front-end Q&A >How to calculate the product in JavaScript

How to calculate the product in JavaScript

藏色散人
藏色散人Original
2021-11-11 16:27:241940browse

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.

How to calculate the product in JavaScript

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:

How to calculate the product in JavaScript

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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn