How to convert a boolean value to yes or no in TypeScript

1 Answer

0 votes
const n = 5;

let s = n > 3;

s = s === true ? 'Yes' : 'No';

console.log(s);

  
  
  
  
/*
run:

"Yes" 
  
*/

 



answered May 15, 2022 by avibootz

Related questions

1 answer 239 views
1 answer 255 views
1 answer 269 views
1 answer 261 views
1 answer 227 views
...