Found 6685 Articles for Javascript

What are the Pros and Cons of JavaScript Frameworks?

Mayank Agarwal
Updated on 28-Apr-2022 13:43:36

310 Views

JavaScript has become the most widely used language in the field of web development in a relatively short span of time. For the last 25 years, the JavaScript frameworks have been driving web developmentIn this article, we are going to elaborate upon the uses of JavaScript frameworks along with their pros and cons. These JavaScript frameworks empower the language to achieve its best with minimal to no configuration. JavaScript can be used as both the frontend and backend technologies.JavaScript FrameworksThese are the frameworks that provide the basic platform for constructing the JavaScript app for developers. This saves the developers most ... Read More

What are the Important Array Methods in JavaScript?

Mayank Agarwal
Updated on 28-Apr-2022 13:35:58

126 Views

In this article, we are going to explore different methods provided by Array and their importance in JavaScript. We will learn how to use them and what are their actual use cases with the help of examples.Before moving on to methods, below is the syntax for creating an array in JavaScript −let array = [element1, element2, ...Alternatively, we can also define the array as follows −let array = new Array (element1, elemnet2, ...Now, we will be learning about the different methods in the array:push() method − This method is used for pushing an element into the array. The element will ... Read More

What are JavaScript Factory Functions?

Mayank Agarwal
Updated on 28-Apr-2022 13:14:57

13K+ Views

A factory function can be defined as a function that creates an object and returns it. It is similar to constructor functions/class functions.The factory function is a very useful tool in JavaScript since it returns the object of any class directly. We can also populate some fixed static values in these factory functions.These functions do not require the use of the ‘this’ keyword for inner values. Also, they do not need the ‘newnew’ keyword when initiating new objects.Factory functions can contain inner values, methods, and many more. They are just like normal functions but with a specific target i.e. to ... Read More

What are JavaScript Classes and Proxies?

Mayank Agarwal
Updated on 28-Apr-2022 13:09:10

122 Views

In this article, we are going to explore Classes and Proxies and the difference between the two.Classes in JavaScript are similar to functions. The only difference is it uses the class keyword instead of the function. Another important difference between the functions and the classes is that the functions can be called in the code even before they are defined. Whereas the class object should be defined before the class object to prevent it from throwing any Reference error.Syntaxclass Classname {    constructor(property1, property2) {       this.property1 = property1;       this.prop erty2 = property2;    } ... Read More

How to Delete a Linked List in JavaScript?

Mayank Agarwal
Updated on 28-Apr-2022 12:18:55

181 Views

In this article, we are going to explore Linked List and how to delete a linked list in JavaScript.A Linked List is a data structure that is used for storing raw data. The Linked List elements are not stored in contiguous memory locations. The elements in a Linked List are linked using pointers.ExampleIn the below example, we are going to delete the linked list in JavaScript.# index.html    Computed Property           Welcome To Tutorials Point               // Javascript program to delete       // a linked ... Read More

JavaScript: How to Find the Middle Element of a Linked List?

Mayank Agarwal
Updated on 28-Apr-2022 12:09:37

1K+ Views

In this article, we are going to explore Linked List and how to find the middle element of a linked list in JavaScript.If there are an even number of elements in the linked list, there will be two middle nodes. We will be only printing the latter element out of both elements.For Example:Linked List: 1->2->3->4->5->6-> nullOutput4There are two ways to find the middle element from a linked list.Method ITraverse the whole list and count the number of nodes. Now traverse the node again till count/2 and return the count/2 i.e. the middle element.Method IITraverse the linked list using 2 pointers i.e. ... Read More

How to use the "in" operator in JavaScript?

Mayank Agarwal
Updated on 28-Apr-2022 11:59:56

138 Views

In this article, we are going to explore the 'in' operator and how to use it in JavaScript. The in operator is an inbuilt operator in JavaScript that is used for checking whether a particular property exists in an object or not. It will return true if the property exists, else false is returned.Syntaxprop in objectParametersThis function accepts the following parameters as described below −prop − This parameter holds the string or symbol that represents a property name or the array index.object − This object will be checked if it contains the prop or not.Return value − This method will ... Read More

How to use Static Variables in JavaScript?

Mayank Agarwal
Updated on 28-Apr-2022 11:55:16

3K+ Views

The keyword "Static" is used for defining a static method or a static property of a class. The benefit of a static method is that we do not need to create an instance or object of the class. It does not have multiple values. It will have a single static value defined during initialization.The keyword static is similar to the const keyword. It is set at the run time when the initialization takes place and these types of variables have global presence and scope. We can use these static variables anywhere over the script.Note − We can reassign and change ... Read More

How to transform JSON text into a JavaScript object?

Mayank Agarwal
Updated on 28-Apr-2022 11:29:00

1K+ Views

In this article, we are going to explore a way to convert the JSON text into a JavaScript object. JSON, also known as JavaScript Object Notation, is a lightweight data-interchange format that is used for exchanging data over web browsers. JSON is derived from the JavaScript programming language but can be used by various other languages also including Python, Java, PHP, Ruby, etc. It is also language-dependent.A JSON mainly follows a key-value data format that saves a value associated with a key. A JSON object consists of curly braces ({}) at both ends to define the starting and ending of ... Read More

How to swap variables using Destructuring Assignment in JavaScript?

Mayank Agarwal
Updated on 26-Apr-2022 13:14:16

202 Views

The Destructuring assignment is a feature that was introduced in the ECMAScript 2015. This feature lets the user extract the contents of the array, and properties of an object into distinct variables without actually writing the repetitive codeThis assignment lets the expression unpack values from arrays, and properties into distinct variables.Example 1In the below example, we use the destructuring assignment to assign variables. In the example, we have two variables defined as first and second. In the method, we are destructing the variables to assign the variables of the array to x and y respectively.# index.html    Checking ... Read More

Advertisements