How to convert string to int number in TypeScript

1 Answer

0 votes
console.log(parseInt('847', 10));
console.log(parseInt('17')); 
console.log(parseInt('89abc')) 
console.log(parseInt('F22')) 
console.log(parseInt('null'))
 
  
   
  
   
   
/*
run:
    
847 
17 
89 
NaN
NaN 
    
*/

 



answered Oct 26, 2021 by avibootz
edited Feb 19, 2022 by avibootz

Related questions

1 answer 147 views
2 answers 282 views
1 answer 197 views
1 answer 217 views
2 answers 174 views
...