Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
-
Economics & Finance
Javascript Articles
Page 498 of 534
Spread operator in function calls JavaScript
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 MoreSet JavaScript object values to null?
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 MoreHow to create an array of integers in JavaScript?
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 MoreJavaScript Remove non-duplicate characters from string
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 MoreArrays vs Set in JavaScript.
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 MoreJavaScript reduce sum array with undefined values
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 MoreHow to stream large .mp4 files in HTML5?
Streaming large MP4 files in HTML5 requires proper video encoding and server configuration to enable progressive download while the video plays. Video Encoding Requirements For HTML5 streaming, MP4 files need special encoding where metadata is moved to the beginning of the file. This allows browsers to start playback before the entire file downloads. Using mp4FastStart The mp4FastStart tool relocates metadata to enable streaming: // Command line usage mp4faststart input.mp4 output.mp4 Using HandBrake HandBrake video encoder includes a "Web Optimized" option that automatically prepares MP4 files for streaming by moving the metadata ...
Read MoreHow to make a Website step by step?
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 MoreAdd a method to a JavaScript object constructor?
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 MoreBinary Search program in JavaScript
The binary search algorithm works on the divide and conquer principle as it keeps dividing the array in half before searching. To search for an element in an array using binary search, the array should be sorted. In the sorted array, we find the middle element and compare it with the element that has to be searched, and based on the comparison, we either search in the left sub-array, right sub-array, or return the middle element. In this article, we are given a sorted array of integers, and our task is to search for the given target element ...
Read More