- ES6 教程
- ES6 - 首頁
- ES6 - 概述
- ES6 - 環境
- ES6 - 語法
- ES6 - 變數
- ES6 - 運算子
- ES6 - 決策
- ES6 - 迴圈
- ES6 - 函式
- ES6 - 事件
- ES6 - Cookie
- ES6 - 頁面重定向
- ES6 - 對話方塊
- ES6 - Void 關鍵字
- ES6 - 頁面列印
- ES6 - 物件
- ES6 - Number
- ES6 - Boolean
- ES6 - String
- ES6 - Symbol
- ES6 - 新 String 方法
- ES6 - 陣列
- ES6 - Date
- ES6 - Math
- ES6 - RegExp
- ES6 - HTML DOM
- ES6 - Iterator
- ES6 - 集合
- ES6 - 類
- ES6 - Map 和 Set
- ES6 - Promise
- ES6 - 模組
- ES6 - 錯誤處理
- ES6 - 物件擴充套件
- ES6 - Reflect API
- ES6 - Proxy API
- ES6 - 驗證
- ES6 - 動畫
- ES6 - 多媒體
- ES6 - 除錯
- ES6 - 影像對映
- ES6 - 瀏覽器
- ES7 - 新特性
- ES8 - 新特性
- ES9 - 新特性
- ES6 實用資源
- ES6 - 速查指南
- ES6 - 實用資源
- ES6 - 討論
ES6 - Math round() 函式
對數字進行四捨五入,使其接近於最接近的整數。
語法
Math.round( x ) ;
引數
- X - 表示一個數字
例子
console.log("---Math.round()---")
console.log("Math.round(7.2) : "+Math.round(7.2))
console.log("Math.round(-7.7) : "+Math.round(-7.7))
輸出
---Math.round()--- Math.round(7.2) : 7 Math.round(-7.7) : -8
廣告