Some text in the Modal..

Some text in the Modal..

Learn JavaScript Data Types (Beginners Guide) | BJ Creations

Type something and hit enter

ads here
On
advertise here
Image result for javascript
JavaScript Data Types
JavaScript variables can hold many data types: numbers, strings, objects and more:

var length = 16;                               // Number
var lastName = "Johnson";                      // String
var x = {firstName:"John", lastName:"Doe"};    // Object
The Concept of Data Types
In programming, data types is an important concept.

To be able to operate on variables, it is important to know something about the type.

Without data types, a computer cannot safely solve this:

var x = 16 + "Volvo";
Does it make any sense to add "Volvo" to sixteen? Will it produce an error or will it produce a result?

JavaScript will treat the example above as:

var x = "16" + "Volvo";
When adding a number and a string, JavaScript will treat the number as a string.

Example
var x = 16 + "Volvo";

Thanks.

Click to comment