How to check if a value is truthy in Node.js

1 Answer

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


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

 



answered Feb 7, 2022 by avibootz

Related questions

1 answer 104 views
1 answer 117 views
1 answer 114 views
114 views asked Jun 29, 2022 by avibootz
1 answer 123 views
1 answer 122 views
...