Skip to content

Latest commit

ย 

History

History
40 lines (33 loc) ยท 1.07 KB

File metadata and controls

40 lines (33 loc) ยท 1.07 KB

string to boolean

!! ์ฃผ์˜

  • !!'false' โ†’ true

Boolean() ์ฃผ์˜

  • Boolean('false') โ†’ true
let string = 'true';

console.log( !!string );                // true
console.log( Boolean(string) );         // true
console.log( string === 'true' );       // true
console.log( string === 'false' );      // false
let string = 'false';

console.log( !!string );                // โš ๏ธ true
console.log( Boolean(string) );         // โš ๏ธ true
console.log( string === 'true' );       // false
console.log( string === 'false' );      // true
let string = 'TRUE';

console.log( !!string );                // true
console.log( Boolean(string) );         // true
console.log( string === 'true' );       // โš ๏ธ false
console.log( string === 'false' );      // โš ๏ธ false
let string = 'FALSE';

console.log( !!string );                // โš ๏ธ true
console.log( Boolean(string) );         // โš ๏ธ true
console.log( string === 'true' );       // false
console.log( string === 'false' );      // false