[Javascript] Làm việc với số
//Số và làm việc với số
//Keyword: - typeof - Kiếm tra kiểu của biến
//-Number with methods
//==================================================================
//1. Number
//Cách 1: Nên sdung
var myNum=18
var myNum1=3.14
//Cách 2:
var otherNum=new Number(9)
//NaN: Đại diện cho số không hợp lệ
//Sủ dụng hàm isNaN
//2. Làm việc với Number
//ToString() - Convert thành chuối
console.log(otherNum.toString())
//toFixed - Làm tròn
console.log(otherNum.toFixed(2))//Làm tròn với 2 or n số thập phân
Nhận xét
Đăng nhận xét