Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • How to convert a integer to binary using Javascript

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 138
    Comment on it

    Hello, If you need to convert the interger to binary then by using Javasript you can perform it very fast, Let see the example below:-

    var binary = (56 >>> 0).toString(2); 
    console.log(binary); 
    console.log(parseInt(binary, 2) >> 0); 
    

    OutPut:-

    1100011 //binary
    99 //integer
    

    Now you can make it able to use in function dynamic:-

    function decimalTobinary(yourdec){
        return (yourdec >>> 0).toString(2);
    }
    

    Now you can use this as anywhere and its works perfect.

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: