Beyond
Beyond

Reputation: 139

In JavaScript, what is the difference between var a=5. and var a=5?

Such as the Title Description

In JavaScript, what is the difference between var a=5. and var a=5?

typeof(5.)  //return number

typeof(5)  //return number

Upvotes: 1

Views: 765

Answers (1)

Bhojendra Rauniyar
Bhojendra Rauniyar

Reputation: 85575

In javascript floating point numbers are also considered as number so typeof(5.) is equal to typeof(5.0) which returns number.

Upvotes: 8

Related Questions