Author: saqibkhan
-
DataView
TheDataViewis an object in JavaScript that allows you to work with the binary data stored in theArrayBuffer. It provides a low-level interface for reading and writing number types in a binary ArrayBuffer. The DataView object provides built-in methods for reading and writing 1, 2, and 4-byte signed and unsigned integers, as well as 4 and…
-
Date
The Date object is a datatype built into the JavaScript language. Date objects are created with the new Date( ) as shown below. Once a Date object is created, a number of methods allow you to operate on it. Most methods simply allow you to get and set the year, month, day, hour, minute, second, and millisecond…
-
Array
The JavaScript Array object lets you store multiple values in a single variable. An array is used to store a sequential collection of multiple elements of same or different data types. In JavaScript, arrays are dynamic, so you dont need to specify the length of the array while defining the array. The size of a JavaScript array…
-
Strings
The String object in JavaScript lets you work with a series of characters; it wraps JavaScript’s string primitive data type with a number of helper methods. As JavaScript automatically converts between string primitives and String objects, you can call any of the helper methods of the String object on a string primitive. The string is a sequence…
-
The Boolean Object
The JavaScript Boolean object represents two values, either “true” or “false”. You can create a boolean object using the Boolean() constructor with a ‘new’ keyword. It takes a value as parameter and returns a boolean object. If value parameter is omitted or is 0, -0, null, false, NaN, undefined, or the empty string (“”), the object has…
-
The Number Object
The JavaScript Number object represents numerical data as floating-point numbers. It contains different properties (constants) and methods for working on numbers. In general, you do not need to worry about Number objects because the browser automatically converts number literals to instances of the number class. A JavaScript Number object can be defined using the Number constructor. Other types of…
-
Smart Function Parameters
The concept of smart function parameters in JavaScript is a way to make a function adaptable to different use cases. It allows the function to handle the different kinds of arguments passed to it while invoking it. In JavaScript, the function is an important concept for reusing the code. In many situations, we need to ensure the…
-
Global Variables
JavaScript Global Variables The global variables in JavaScript are the variables that are defined outside of the function or any particular block. They are accessible from anywhere in JavaScript code. All scripts and functions can access the global variables. You can define the global variables using the var, let, or const keyword. The variables defined without using any of the var,…
-
Variable Scope
JavaScript Variable Scope The variable scope in JavaScript determines to the accessibility and visibility of the variable in different part of the code. The scope is the current context of the code execution. This means the variable scope is determined by where it is executed not by where it is declared. In JavaScript, the objects and functions are also…
-
Closures
What is Closure? The concept of closures in JavaScript allows nested functions to access variables defined in the scope of the parent function, even if the execution of the parent function is finished. In short, you can make global variables local or private using the closures. A JavaScript closure is basically a combination of the function and its lexical environment.…