Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save khalid32/16736e8576fc1f479bd4f4b2160ffa31 to your computer and use it in GitHub Desktop.
Save khalid32/16736e8576fc1f479bd4f4b2160ffa31 to your computer and use it in GitHub Desktop.
// === Binary to Decimal Conversion Example ===
var binary = "10";
var digit = parseInt(binary, 2);
console.log(' digit --> ',digit);
// === Decimal to Binary Conversion Example ===
var str = "2";
var bin = (+str).toString(2);
console.log(bin)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment