LoginSignup
0
0

More than 3 years have passed since last update.

JavaScriptのデータ型について

Posted at

JavaScriptで扱うデータの種類について

JavaScriptでは8種類のデータ型が定義されています。
よく出てくるものの例として以下の物が挙げられます。

  • Number(数値)
    • 3, 5, 18, 0 etc...
  • String(文字列)
    • 'Hello', 'Good' etc...
  • Boolean(真偽値)
    • true, false
  • Object(オブジェクト)

またJavaScriptにはデータ型の種類を調べるtypeof演算子というものが用意されています。

console.log(typeof 5);
console.log(typeof 'Hellow');
console.log(typeof true);

出力結果

number
string
boolean

まとめ

まだ初学者のため使い所がいまいちピンと来ていませんが(そういう人僕の他にもいますか?)いつかあ〜typeof演算子ね〜ウンチクウンチクくらいになれたらいいな、、、、

参考

MDN web docs

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0