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 124 views
1 answer 116 views
1 answer 115 views
1 answer 125 views
1 answer 111 views
...