SIGN IN SIGN UP

Login to your account

Username or Email *
Password *
Remember Me
LWC Progress | ( Lessons)

Lesson: 01 | Data Types


JavaScript has several built-in data types that you can use. Here are the commonly used data types in JavaScript:

Number: Represents numeric values, including integers and floating-point numbers.

let age = 25;
let pi = 3.14;

String: Represents textual data enclosed in single quotes (') or double quotes (").

let name = 'John';
let message = "Hello, world!";

Boolean: Represents either true or false, indicating the truth value of an expression.

let isTrue = true;
let isFalse = false;

Object: Represents a collection of key-value pairs, where values can be of any data type. Objects are denoted by curly braces {}.

let person = {
  name: 'John',
  age: 30,
  city: 'New York'
};

Array: Represents an ordered list of values, which can be of any data type. Arrays are denoted by square brackets [].

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

Null: Represents the intentional absence of any object value. It is a primitive value that denotes the absence of an object reference.

let data = null;

Undefined: Represents an uninitialized or undefined value. It is typically the default value of variables that have been declared but not assigned a value.

let variable;
console.log(variable);  // Output: undefined

Symbol: Represents a unique identifier. Symbols are often used as keys in objects to avoid naming conflicts. Symbols are created using the Symbol() function. Introduced in ECMAScript 6 (ES6).

const id = Symbol('id');
let obj = {
  [id]: '12345'
};

BigInt: Represents integers with arbitrary precision. It allows you to work with numbers beyond the Number data type's limit. BigInts are created by appending n to the end of an integer literal or by using the BigInt() constructor. Introduced in ECMAScript 2020.

let bigNumber = 1234567890123456789012345678901234567890n;


You need to login to have access to the quizzes. Next

Mastered by 15 users.

Lightning Web Components

A. Component Reference (27 lessons)
B. Lightning Web Components | Utilities (11 lessons)
C. Lightning Web Component Guide (41 lessons)
D. Java Script Methods for LWC (23 lessons)
E. HTML (18 lessons)
Go to top