Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to convert 2 to 10 in javascript

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly explains "how to convert 2 to 10 in javascript". The explanation in this article is simple and clear and easy to learn and understand. Please follow the editor's train of thought to study and learn "how to convert 2 to 10 in javascript".

In javascript, you can use the parseInt () function to convert a binary value to a decimal value, which parses a specified cardinality (base) string and returns a decimal integer; the syntax "parseInt (" binary string ", 2)".

The operating environment of this tutorial: windows7 system, javascript1.8.5 version, Dell G3 computer.

In javascript, you can use the parseInt () function to convert a binary value to a decimal value.

Syntax:

ParseInt (stringNum, [radix])

The stringNum parameter is a string that needs to be converted to an integer; the radix parameter is a number between 2 and 36, indicating the binary number of the stringNum parameter. A value of 10:00 can be omitted.

The purpose of parseInt () is to parse the radix-based stringNum string parameter into a decimal number. If the stringNum string does not begin with a legal character, if an illegal character is encountered during NaN; parsing, the parsing will be stopped immediately and the parsed value will be returned.

Example:

Console.log (parseInt ("101110100", 2)); / convert to decimal console.log (parseInt ("1101", 2)); / / convert to decimal

Thank you for reading, the above is the content of "how to convert 2 to 10 in javascript". After the study of this article, I believe you have a deeper understanding of how to convert 2 to 10 in javascript, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

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.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report