Home > Web Front-end > Front-end Q&A > How to write square in javascript

How to write square in javascript

藏色散人
Release: 2021-10-27 14:21:15
Original
4748 people have browsed it

The ways to write JavaScript squares are: 1. "console.log(2*10**3)" method; 2. "console.log(2*Math.pow(10,3))" method; 3. "console.log(2e3)" method and so on.

How to write square in javascript

The operating environment of this article: windows7 system, javascript version 1.8.5, Dell G3 computer.

How to write square in javascript?

Three ways to calculate square numbers in JavaScript

console.log(2*10**3)
console.log(2*Math.pow(10,3))
console.log(2e3)
console.log(2*1e3)
console.log(2*10e2)
console.log(2*1000e0)
console.log(2*100000e-2)
Copy after login

The calculation results are all equal to 2000.

[Recommended learning: javascript basic tutorial]

The above is the detailed content of How to write square in javascript. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template