Skip to content

Instantly share code, notes, and snippets.

@theasta
Created March 29, 2015 16:39

Revisions

  1. theasta created this gist Mar 29, 2015.
    11 changes: 11 additions & 0 deletions radix-conversion.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,11 @@
    // Convert from decimal to binary
    (11).toString(2) // “1011"

    // Convert from decimal to hexadecimal
    (255).toString(16) // ‘ff'

    // Convert from binary to decimal
    parseInt("1011", 2); // 11

    // Convert from binary to hexadecimal
    parseInt("ff", 16); // 255