論理型 (boolean type)
JavaScriptの論理型(boolean type)は、trueとfalseの論理値からなる型です。
論理型リテラル#
JavaScriptの論理型リテラルはtrueまたはfalseを用いて次のように書きます。
javascriptconst isOk = true;const isOk = false;
javascriptconst isOk = true;const isOk = false;
論理型の型注釈#
TypeScriptの論理型の型注釈はbooleanを使います。
typescriptconst isOk: boolean = true;
typescriptconst isOk: boolean = true;
TypeScriptには大文字で始まるBoolean型がありますが、これとbooleanは別の型です。