Results 1 to 4 of 4
  1. #1
    Senior Member
    Join Date
    Apr 2015
    Posts
    134

    Lightbulb How do you convert numbers between different bases in JavaScript ?

    Please share your opinion about the converting of numbers between the different bases in JavaScript....!

  2. #2
    Senior Member
    Join Date
    Dec 2008
    Posts
    989
    Personally I have been extremely and painlessly satisfied dealing with Linovus.ca web development services.
    They have top-notch customer service, responding to trouble tickets immediately and consistently. Contact them if you need to solve any problems.

  3. #3
    Senior Member
    Join Date
    Feb 2015
    Location
    Bangalore
    Posts
    528
    By using the parseInt() function, we can convert numbers between different bases in JavaScript. This function takes a string as the first parameter, and the base as a second parameter


    Web Design Company in Bangalore | Web Development Company in Bangalore | Website Development Company in Bangalore | Website Design Company in Bangalore

  4. #4
    Registered User
    Join Date
    Apr 2019
    Posts
    57
    To convert hex string to number then parseInt(string, radix) is used.
    To convert number to hex string then object.tostring(radix) is used.

    radix is a base. It's value is 2,8,16...etc.

    Integer to hex :

    Example :

    var i = 10;
    console.log( i.toString(16) );

    output : a

    Hex string to int :

    var h = "a";
    console.log( parseInt(h, 16) );

    output : 10

    I hope this'll help you.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

  Find Web Hosting      
  Shared Web Hosting UNIX & Linux Web Hosting Windows Web Hosting Adult Web Hosting
  ASP ASP.NET Web Hosting Reseller Web Hosting VPS Web Hosting Managed Web Hosting
  Cloud Web Hosting Dedicated Server E-commerce Web Hosting Cheap Web Hosting


Premium Partners:


Visit forums.thewebhostbiz.com: to discuss the web hosting business, buy and sell websites and domain names, and discuss current web hosting tools and software.