Web Development Articles

Page 516 of 801

JavaScript fetch a specific value with eval()?

Disha Verma
Disha Verma
Updated on 15-Mar-2026 485 Views

The eval() function in JavaScript allows the execution of code stored as a string. It can be used to fetch specific values dynamically, but be careful, as it can have security risks and affect performance. This article will guide you on how to use eval() to get specific values and why you should generally avoid using eval(). How eval() Works The eval() function takes a string as an argument and evaluates it as JavaScript code. For example: console.log(eval("2 + 2")); // Output: 4 console.log(eval("'Hello' + ' World'")); // Output: Hello World 4 Hello World ...

Read More

JavaScript code to extract the words in quotations

Disha Verma
Disha Verma
Updated on 15-Mar-2026 486 Views

Extracting text enclosed in quotation marks is a common task in programming, especially when working with strings that include quotes. In JavaScript, strings are a data type used to represent text. A string is a sequence of characters enclosed in single quotes ('), double quotes ("), or backticks (`). JavaScript provides multiple ways to extract text enclosed in quotation marks. This article explains how to extract words or phrases inside quotations from a string efficiently using different approaches. Methods to Extract Quoted Text Extracting text enclosed in quotation marks can be done in the following ways: ...

Read More

Spread operator in function calls JavaScript

Disha Verma
Disha Verma
Updated on 15-Mar-2026 901 Views

The spread operator in function calls enhances the function parameter handling. The spread operator allows you to expand an array or any iterable across zero or more arguments in a function call. This article will guide you on using the spread operator in a function call. The spread operator is a powerful feature of JavaScript that allows one to perform operations for complex and lengthy code in a simple single line of code. The spread operator is denoted by the (...) (triple dot) symbol. Syntax The basic syntax of spread operator for function calls is mentioned below: ...

Read More

Set JavaScript object values to null?

Disha Verma
Disha Verma
Updated on 15-Mar-2026 6K+ Views

Setting object values to null can help reset data, free up memory, or show that a value is no longer needed. In JavaScript, the null value is used to indicate that there is an intentional absence of any object value. This article provides various methods for setting JavaScript object values to null and what that means. Setting an Object's Values to null Setting object values to null can be done in two types: For Specific Object Value For Multiple Object Values For Specific Object Value ...

Read More

How to create an array of integers in JavaScript?

Alshifa Hasnain
Alshifa Hasnain
Updated on 15-Mar-2026 18K+ Views

In this article, we will learn to create an array of integers in JavaScript. The Array parameter is a list of strings or integers. When you specify a single numeric parameter with the Array constructor, you specify the initial length of the array. The maximum length allowed for an array is 4, 294, 967, 295. Different Approaches The following are the two different approaches to creating an array of integers in JavaScript − Using Array Literals Using the Array Constructor Using Array Literals One of ...

Read More

JavaScript Remove non-duplicate characters from string

Disha Verma
Disha Verma
Updated on 15-Mar-2026 593 Views

Non-duplicate characters in a string are those that appear only once and do not repeat within the string. Sometimes in JavaScript, we need to work with strings and manipulate them based on certain conditions. One common task is to remove characters that only appear once in a string, keeping only the characters that appear more than once. In this article, we will understand how to remove non-duplicate characters from a string in JavaScript. Understanding the Problem Suppose we have a string like "teeth_foot". We want to remove all characters that appear only once, keeping only characters that appear multiple ...

Read More

Arrays vs Set in JavaScript.

Alshifa Hasnain
Alshifa Hasnain
Updated on 15-Mar-2026 3K+ Views

In this article, we will learn about the difference between an array and a set in JavaScript. Arrays are used to store ordered collections of elements, whereas Sets store only unique values in an unordered collection. What is an Array? An Array is an ordered, indexed collection of values in JavaScript. It allows duplicate values and provides various built-in methods to manipulate elements. Syntax let numbers = [1, 2, 3, 4, 5]; What is a Set? A Set is an unordered collection of unique values in JavaScript. Unlike arrays, a Set automatically ...

Read More

JavaScript reduce sum array with undefined values

AmitDiwan
AmitDiwan
Updated on 15-Mar-2026 1K+ Views

If you're working with arrays in JavaScript, you may encounter situations where your array contains undefined values. This can happen when you're processing data from various sources or working with incomplete datasets. One common problem developers face is summing the values of an array with undefined elements. JavaScript's reduce() method is a versatile tool that can help you solve this problem efficiently. What is the reduce() Method in JavaScript? The reduce() method in JavaScript is a powerful tool that allows you to iterate over an array and accumulate a single result. It takes a callback function as its ...

Read More

How to make a Website step by step?

Ali
Ali
Updated on 15-Mar-2026 1K+ Views

A website is a collection of web pages containing content, images, videos, and other elements, accessible through a unique domain name and hosted on a web server. Creating a website involves several key steps from planning to deployment. Step 1: Choose and Register a Domain A domain is the web address users type to access your website (e.g., www.tutorialspoint.com). Each domain is unique and serves as your website's identity on the internet. Purchase a domain name from registrars like GoDaddy, Namecheap, or other hosting companies. Here's how a domain appears in the browser address bar: ...

Read More

Add a method to a JavaScript object constructor?

Vivek Verma
Vivek Verma
Updated on 15-Mar-2026 3K+ Views

In JavaScript, adding a method (function) to a constructor is different from adding a method to a regular object. To add a method to a constructor, we need to define it inside the constructor or in its prototype (using which JavaScript objects inherit features from one another). We can create an object in the following ways in JavaScript: Using the function Constructor (older way): function person(){ } const p = new person(); Using ES6 Class Syntax (i.e., modern way): class person{ constructor(){} } const p = new person(); ...

Read More
Showing 5151–5160 of 8,010 articles
« Prev 1 514 515 516 517 518 801 Next »
Advertisements