How to convert binary string to integer in TypeScript

1 Answer

0 votes
console.log(Number.parseInt('1111', 2));
 
const s = '0111';
console.log(Number.parseInt(s, 2));
 
console.log(Number.parseInt('0011', 2));
 
 
 
/*
run:
  
15
7
3
     
*/

 



answered Jul 18, 2025 by avibootz
...