Type Converstion
- string to number
- number to string
- Dates to numbers
- Numbers to dates
- Booleans to numbers
- numbers to booleans
Converting Strings to Numbers
the gloabl method Number() converts a variable into a number
The unary + operator can be used to convert a variable to a number
** Converting number to string**
String()
x.tostring()
Converting date to String
String(Date())
Date().tostring()
(date.getMonth()+1).toString(); to get month the because the integer between 0(january) and 11 (december)
Converting Boolean to Number
- number()
-true.tostring()
Condition

Top comments (0)