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 149 views
1 answer 162 views
1 answer 168 views
1 answer 176 views
1 answer 120 views
...