logo

Binary Addition

Implement a function that adds two numbers together and returns their sum in binary. The conversion can be done before, or after the addition.


My code:


                        function addBinary(a,b) {
                            let sum = a+b;
                            let binary = sum.toString(2);
                            return binary;
                          }
                    


And that's the best solution among all users:


                        function addBinary(a,b){
                            return (a+b).toString(2)
                          }