parseInt()
converts a string to an integer. It reads the string until it finds a non-digit character.
Example: parseInt("123abc")
returns 123.
parseFloat()
converts a string to a floating-point number. It reads the string until it finds a non-numeric character (except decimal point).
Example: parseFloat("123.45xyz")
returns 123.45.
The Date
object in JavaScript is used to work with dates and times.
Example: new Date("2025-06-19")
creates a date object for June 19, 2025.
You can also use new Date(year, monthIndex, day)
where monthIndex
starts from 0 (January).