In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-10 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article is about what data type conversion functions are available in JavaScript. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.
The data type conversion functions are: toExponential (), toFixed (), toPrecision (), String (), getDate (), getFullYear (), Number (), parseFloat (), parseInt (), and so on.
The operating environment of this tutorial: windows7 system, javascript1.8.5 version, Dell G3 computer.
Data type conversion in JavaScript
1. Convert numbers to strings
ToExponential () converts the value of the object to an exponential counting method.
ToFixed () converts a number to a string with a specified number of digits after the decimal point of the result.
ToPrecision () formats the number to the specified length.
2. Convert a Boolean value to a string
String (): Boolean values can be converted to strings
3. Convert the date to a string
Date () returns a string representing the date
String () can convert a date object to a string
GetDate () returns the day of the month (1-31) from the Date object.
GetDay () returns the day of the week (0-6) from the Date object.
GetFullYear () returns the year in four digits from the Date object.
GetHours () returns the hours of the Date object (0-23).
GetMilliseconds () returns the milliseconds (0-999) of the Date object.
GetMinutes () returns the minutes of the Date object (0-59).
GetMonth () returns the month (0-11) from the Date object.
GetSeconds () returns the number of seconds of the Date object (0-59).
GetTime () returns the number of milliseconds since January 1, 1970.
4. Convert strings to numbers
Number (): you can convert strings to numbers
ParseFloat () parses a string and returns a floating point number.
ParseInt () parses a string and returns an integer.
Thank you for reading! This is the end of this article on "what data type conversion function in JavaScript". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, you can share it for more people to see!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.