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 133 views
1 answer 123 views
1 answer 121 views
1 answer 134 views
1 answer 118 views
...