How does JavaScript define data types
This article mainly introduces the relevant knowledge of how JavaScript defines data types, the content is detailed and easy to understand, the operation is simple and fast, and it has a certain reference value. I believe you will gain something after reading this JavaScript article on how to define data types. Let's take a look at it.
In JavaScript, you can define declaration data types with the keyword "new" and define syntax such as "var carname=new String;var x = new Number;".
This article operating environment: windows7 system, javascript1.8.5 version, DELL G3 computer
How does JavaScript define data types?
JavaScript data type
String values, numeric values, Boolean values, arrays, objects.
JavaScript data type
JavaScript variables can hold multiple data types: numeric values, string values, arrays, objects, and so on:
Var length = 7; / / numeric var lastName = "Gates"; / / string var cars = ["Porsche", "Volvo", "BMW"]; / / Array var x = {firstName: "Bill", lastName: "Gates"}; / / object
Define the variable type:
When you declare a new variable, you can use the keyword "new" to declare its type:
Var carname=new String;var x = new Number;var y = new Boolean;var cars= new Array;var person= new Object; this article on "how JavaScript defines data types" ends here. Thank you for reading! I believe you all have a certain understanding of "how to define data types in JavaScript". If you want to learn more, you are welcome to follow the industry information channel.