My code working perfectly fine :
const getValueOf=(y)=>{return parseInt('1'.repeat(y),2)};
/*
| Chars | Binary | Decimal
| 4 | 1111 | 15
*/
console.log(getValueOf(4)); // = 15
/*
| Chars | Binary | Decimal
| 10 | 1111111111 | 1023
*/
console.log(getValueOf(10)); // = 1023
/* -------------- */
console.time('I bet it can be FASTER!');
for(let z=0;z<10000000;++z){getValueOf(10)};
console.timeEnd('I bet it can be FASTER!')
However I feel like covert it to text is a bit sloppy way to solve the issue and I bet there is much faster way to make it work
Your take in 3… 2… 1…