data types in javascript(typeof null)

总结:

There are 7 basic types in JavaScript.

  • number for numbers of any kind: integer or floating-point.
  • string for strings. A string may have one or more characters, there’s no separate single-character type.
  • boolean for true/false.
  • null for unknown values – a standalone type that has a single value null.
  • undefined for unassigned values – a standalone type that has a single value undefined.
  • object for more complex data structures.
  • symbol for unique identifiers.

The typeof operator allows us to see which type is stored in a variable.

  • Two forms: typeof x or typeof(x).
  • Returns a string with the name of the type, like "string".
  • For null returns "object" – this is an error in the language, it’s not actually an object

Data types

猜你喜欢

转载自blog.csdn.net/BobChill/article/details/86592760
今日推荐