How to check if a value is truthy in TypeScript

1 Answer

0 votes
const s = 'typescript';
 
if (s) {
   console.log("truthy")
} 


const n = 901;
 
if (n) {
   console.log("truthy")
} 
 
 
 
 
 
/*
run:
 
"truthy"
"truthy"
 
*/

 



answered Feb 7, 2022 by avibootz

Related questions

1 answer 140 views
1 answer 131 views
1 answer 124 views
1 answer 142 views
1 answer 124 views
...