javascript round() method
Translation results:
英[raʊnd] 美[raʊnd]
adj. Round; arc-shaped; plump, fat; integer
adv. Everywhere; around; roundabout ; in the opposite direction
prep.approximately; around, surrounding; (indicating position) around; nearby
n. circle, circle; cycle; round object, spherical object; (Meeting) One round
vt.& vi. Make a circle; go around; turn around; round...
Third person singular: rounds Plural: rounds present participle : rounding Past tense: rounded Past participle: rounded Comparative: rounder Superlative: roundest
javascript round() methodsyntax
Function: Round a number to the nearest integer.
Syntax: Math.round(x)
Parameters: x Required. Must be a number.
Return: The integer closest to x.
Note: For 0.5, this method will round up. For example, 3.5 will be rounded to 4, and -3.5 will be rounded to -3.
javascript round() methodexample
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Title</title> </head> <body> <script type="text/javascript"> //不同的数舍入为最接近的整数 document.write(Math.round(0.60) + "<br />") document.write(Math.round(0.50) + "<br />") document.write(Math.round(0.49) + "<br />") document.write(Math.round(-4.40) + "<br />") document.write(Math.round(-4.60)) </script> </body> </html>
Run instance »
Click the "Run instance" button to view the online instance
Popular Recommendations
- Litecoin Round-Trips 2024 Gains as Crypto Rally Deflates
- Polymarket Eyes $50M Funding Round, Considers Launching Token as Crypto Market Recovers
- Celestia Foundation Raises $100M in Funding Round to Drive Innovation in Blockchain Scalability and Accessibility
- Depot After Dark: Fields Coin Toss, Steelers Business Trip, Former First-Round Picks Suit Up
- Chaos Labs Gains Recognition for Its DeFi Risk Management Tools, Secures $55M Series A Funding Round
- Rare £1 coins: The 12 most valuable round pound coins in circulation and how much they are worth