Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function convertDecimalToBinary(number){
- let result = '';
- while(number > 0){
- result = number%2 + result;
- number = Math.trunc(number/2);
- }
- console.log(result);
- }
- //Change the number if you want
- convertDecimalToBinary(11);
Add Comment
Please, Sign In to add comment