pbchandra's blog

By pbchandra, 6 weeks ago, In English

Data types are divided into two types in java script 1)Primitives 2)Objects

1) Primitive Types:(7)

Numbers:-

Number types are always floats

//Dynamic typing
let n = 8
console.log(typeof n) // number type
let num1 = 100_000_00
let num2 = 0xff // Hexadecimal
let num3 = 5 / 0 

console.log(num3) //Infinity
//_#Using Template literals_
console.log(`addition of numbers of $$${typeof num1} is $$${num1 + 20}`) //addition of numbers of number is 10000020
console.log(Number.MAX_VALUE) //1.7976931348623157e+308

Strings:-

let user = "Bhuvana"

Booleans:-


console.log(5>7) >>false typeof (false) >> "boolean"

NaN:-


console.log(5/'five') // NaN

undefined:-

let c;
console.log(typeof c) //undefined
console.log(c) //undefined

null:-

let a =null;

console.log(typeof a) //  "object" #bug in js

console.log(a) // null

Big int:-


//bigint let big = 16545646546546546546532n console.log(typeof big)
 
 
 
 
  • Vote: I like it
  • -19
  • Vote: I do not like it