Author: Saim Khalid
-
Logical Operators
JavaScript Logical Operators The logical operators in JavaScript are generally used with Boolean operands and return a boolean value. There are mainly three types on logical operators in JavaScript – && (AND), || (OR), and ! (NOT). These operators are used to control the flow the program. Although the logical operators are typically used with Boolean values, they can…
-
Comparison Operators
JavaScript Comparison Operators The comparison operators in JavaScript compare two variables or values and return a boolean value, either true or false based on comparison result. For example, we can use the comparison operators to check whether two operands are equal or not. The comparison operators are used in logical expressions. A logical expression is…
-
Arithmetic Operators
JavaScript Arithmetic Operators Arithmetic operators in JavaScript perform mathematical calculations on numeric values (operands). Most of the arithmetic operators are binary operators as they perform calculations on two operands. Some arithmetic operators are unary operators. The unary operators perform computation on a single operand. JavaScript supports many arithmetic operators such as addition, subtraction, multiplication, division…
-
Operators
What is an Operator? In JavaScript, an operator is a symbol that performs an operation on one or more operands, such as variables or values, and returns a result. Let us take a simple expression 4 + 5 is equal to 9. Here 4 and 5 are called operands, and + is called the operator. JavaScript supports the following types of…
-
Reserved Keywords
Reserved Keywords in JavaScript The reserved keywords in JavaScript are predefined keywords used to serve the built-in functionality of the programming language. For example, the var and let keywords are used to define variables, the function keyword is used to define the functions, etc. JavaScript contains more that fifty reserved keywords. In simple terms, you can’t use the reserved keywords as an identifier.…
-
Strict Mode
Strict Mode in JavaScript In JavaScript, the strict mode is introduced in the ES5 (ECMAScript 2009). The purpose behind introducing the “strict mode” is to make the JavaScript code more secure. The ‘use strict‘ literal expression is used to add the strict mode in the JavaScript code. It removes the silent errors from the code, such as…
-
Type Conversions
JavaScript Type Conversions Type Conversions in JavaScript refer to the automatic or explicit process of converting data from one data type to another in JavaScript. These conversions are essential for JavaScript to perform operations and comparisons effectively. JavaScript variables can contain the values of any data type as it is a weakly typed language. There are…
-
Data Types
JavaScript Data Types Data types in JavaScript referes to the types of the values that we are storing or working with. One of the most fundamental characteristics of a programming language is the set of data types it supports. These are the type of values that can be represented and manipulated in a programming language. JavaScript data…
-
Constants
JavaScript constants are the variables whose values remain unchanged throughout the execution of the program. You can declare constants using the const keyword. JavaScript const Keyword The const keyword is introduced in the ES6 version of JavaScript with the let keyword. The const keyword is used to define the variables having constant reference. A variable defined with const can’t be re-declared, reassigned. The const declaration have…
-
let Statement
What is JavaScript let statement? The JavaScript let statement is used to declare a variable. With the let statement, we can declare a variable that is block-scoped. This mean a variable declared with let is only accessible within the block of code in which it is defined. The let keyword was introduced in the ES6 (2015) version of JavaScript. It is an…