Type Castingとは
型変換 (または型キャスト) とは、あるデータ型から別のデータ型へのデータの転送を意味します。
let a;
let b;
let c;
let d;
a = Number("3.14"); //数値に変換
b = String(3.14); //文字列に変換
c = Boolean(""); //真偽値に変換
d = Boolean("pizza");
console.log(a, typeof a); //3.14 'number'
console.log(b, typeof b); //3.14 string
console.log(c, typeof c); //false 'boolean'
console.log(d, typeof d); //true 'boolean'