Found 8894 Articles for Front End Technology

How to find the sum of all elements of a given array in JavaScript?

Imran Alam
Updated on 23-Jun-2022 13:09:06

799 Views

In programming, it is often necessary to find the sum of all elements in an array. There are many ways to do this in JavaScript. In this tutorial, we are going to look at some of the ways to find the sum of all elements in an array.Using the for loopFinding the sum of all elements in an array is a very common operation in JavaScript, and the for loop is the easiest way to do it. If you are working with arrays in JavaScript, make sure to take advantage of the for loop to find the sum of all ... Read More

How to use the debugger keyword in JavaScript?

Mayank Agarwal
Updated on 28-Apr-2022 14:31:01

574 Views

Whenever an unexpected occurrence takes place in a JavaScript code, we need to debug it to check the cause. Debugging is a very important aspect of programming that lets you determine why a system or application behaves abnormally. It is a process of testing multiple times with different inputs and finding errors to reduce bugs from computer programs.In this article, we will be exploring the debugger keyword in JavaScript and how to use them. The debugger keyword in JavaScript is a common keyword used in debugging processes and variable details. In JavaScript whenever the debugger keyword is turned ON, it ... Read More

How to use setTimeout() function in JavaScript?

Mayank Agarwal
Updated on 28-Apr-2022 14:22:15

4K+ Views

The setTimeout() function is provided by the window object, which calls the specified JavaScript function after the specified time only. This function will be called just once after waiting for the timeout set by the user.It is similar to an alarm or reminder functionality. In the same way, we set up the timeout for the desired time period after which this function is called. This method is used where we are required to add a delay in the execution of a function. This method can also be used for animations or DOM manipulations in JQuert.The input set up in the ... Read More

What is a typical use case for JavaScript anonymous functions?

Mayank Agarwal
Updated on 28-Apr-2022 13:48:59

401 Views

In this article, we are going to explore the Anonymous functions in JavaScript and also learn about their use cases. An anonymous function is a special type of function that does not have any name associated with it.In JavaScript, we normally use the function () keyword before defining any function in JavaScript. However, in anonymous functions in JavaScript, we only use the keyword function for defining the function without any supported name.An anonymous function cannot be accessed after it is created, it can only be accessed by a variable that is stored in the function as the value. An anonymous ... Read More

What are the Pros and Cons of JavaScript Frameworks?

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

311 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

Advertisements