binary to decimal JavaScript
Answers
Answered by
0
Explanation:
JavaScript: Convert a binary number to a decimal number
Pictorial Presentation:
1. Sample Solution:-
2. HTML Code: <! ...
3 .(1)
JavaScript Code: function bin_to_dec(bstr) { return parseInt((bstr + '') .replace(/[^01]/gi, ''),
2); } console.log(bin_to_dec('110011')); console.log(bin_to_dec('100')); ...
Flowchart:
Live Demo:
Similar questions