Hi there, we’re Harisystems

"Unlock your potential and soar to new heights with our exclusive online courses! Ignite your passion, acquire valuable skills, and embrace limitless possibilities. Don't miss out on our limited-time sale - invest in yourself today and embark on a journey of personal and professional growth. Enroll now and shape your future with knowledge that lasts a lifetime!".

For corporate trainings, projects, and real world experience reach us. We believe that education should be accessible to all, regardless of geographical location or background.

1
1

JavaScript Data Types: Explained with Examples

JavaScript is a dynamically typed language, meaning variables can hold values of different data types. Understanding the different data types in JavaScript is crucial for working with and manipulating data effectively. In this article, we will explore the various data types in JavaScript along with examples.

1. Numbers

The number data type represents numeric values. Numbers can be integers or floating-point values. Here's an example:

var age = 25;
var price = 9.99;

2. Strings

The string data type represents a sequence of characters enclosed in single quotes ('') or double quotes (""). Here's an example:

var name = "John Doe";
var message = 'Hello, World!';

3. Booleans

The boolean data type represents logical values - either true or false. Booleans are often used for conditional statements and logical operations. Here's an example:

var isStudent = true;
var isWorking = false;

4. Arrays

Arrays are used to store multiple values in a single variable. JavaScript arrays can hold values of any data type. Here's an example:

var numbers = [1, 2, 3, 4, 5];
var fruits = ['apple', 'banana', 'orange'];

5. Objects

Objects are collections of key-value pairs, where each value can be of any data type. Objects are useful for representing complex entities and organizing related data. Here's an example:

var person = {
  name: "John Doe",
  age: 25,
  isStudent: true
};

6. Null and Undefined

The null and undefined data types represent the absence of value. 'Null' is assigned to a variable when it intentionally does not have a value, while 'undefined' indicates that a variable has been declared but has not been assigned a value. Here's an example:

var emptyValue = null;
var notAssigned;

7. Symbols (ES6)

Symbols are unique and immutable data types introduced in ES6. They are often used as unique identifiers. Here's an example:

var id = Symbol('uniqueId');

These are the main data types in JavaScript. Understanding and utilizing them appropriately is essential for effective programming. Remember that JavaScript is a dynamically typed language, so variables can change their data type as needed during runtime.

4.5L

Learners

20+

Instructors

50+

Courses

6.0L

Course enrollments

4.5/5.0 5(Based on 4265 ratings)

Future Trending Courses

When selecting, a course, Here are a few areas that are expected to be in demand in the future:.

Beginner

The Python Course: Absolute Beginners for strong Fundamentals

By: Sekhar Metla
4.5 (13,245)
Intermediate

JavaScript Masterclass for Beginner to Expert: Bootcamp

By: Sekhar Metla
4.5 (9,300)
Intermediate

Python Coding Intermediate: OOPs, Classes, and Methods

By: Sekhar Metla
(11,145)
Intermediate

Microsoft: SQL Server Bootcamp 2023: Go from Zero to Hero

By: Sekhar Metla
4.5 (7,700)
Excel course

Future Learning for all

If you’re passionate and ready to dive in, we’d love to join 1:1 classes for you. We’re committed to support our learners and professionals their development and well-being.

View Courses

Most Popular Course topics

These are the most popular course topics among Software Courses for learners