JavaScript Declarations and Assignments Data Types

Help us to keep this website almost Ad Free! It takes only 10 seconds of your time:
> Step 1: Go view our video on YouTube: EF Core Bulk Extensions
> Step 2: And Like the video. BONUS: You can also share it!

Example

JavaScript variables can hold many data types: numbers, strings, arrays, objects and more:

// Number
var length = 16;

// String
var message = "Hello, World!"; 

// Array
var carNames = ['Chevrolet', 'Nissan', 'BMW']; 

// Object
var person = {
    firstName: "John",
    lastName: "Doe"
}; 

JavaScript has dynamic types. This means that the same variable can be used as different types:

var a;              // a is undefined
var a = 5;          // a is a Number
var a = "John";     // a is a String


Got any JavaScript Question?