Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

adding binary numbers in javascript

var addBinary = function (a, b) {
  let sum = BigInt(`0b${a}`) + BigInt(`0b${b}`);
  return sum.toString(2);
};
Source by leetcode.com #
 
PREVIOUS NEXT
Tagged: #adding #binary #numbers #javascript
ADD COMMENT
Topic
Name
4+2 =