
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Found 8591 Articles for Front End Technology

156 Views
The array.entries() method of JavaScript is used to return an Array Iterator object with key/value pairs.The syntax is as follows − array.entries()Let us now implement the array.entries() method in JavaScript −Example Live Demo Ranking Points Is any point equal to 550 from the key-value pairs... Result var pointsArr = [10, 20, 30, 40, 50, 60, 70, 80, 90, 1000]; var res = pointsArr.entries(); for (val of res) { document.getElementById("test").innerHTML += val + ""; } ... Read More

190 Views
The from() method of JavaScript is used to return the Array object from any object with a length property or an iterable object.The syntax is as follows −Array.from(obj, mapFunction, val)Above, the parameter obj is the object to convert to an array, mapFunction is a map function to call, val is a value to use as this when executing the mapFunction.Let us now implement the from() method in JavaScript −Example Live Demo Demo Heading var arr1 = Array.from("PQRS"); var arr2 = Array.from("12345"); document.getElementById("test").innerHTML = arr1 ... Read More

804 Views
The findIndex() method of JavaScript is used to return the index of the first element in an array, if the condition is passed.The syntax is as follows −array.findIndex(function(currentValue, index, arr), thisValue)Let us now implement the findIndex() method in JavaScript −Example Live Demo Rank Result Finding the index of the player with highest rank. var points = [100, 150, 200, 250, 300, 400]; function topRank(points) { return points >= 400; } function display() { ... Read More

404 Views
The fill() function is a built-in function of JavaScript which is used to fill all the elements of an array with a static value. This function modifies the original array and returns the modified array. The fill() function of JavaScript is a simple and basic function used to fill an array with a specified function. In this article, you will understand the usage and functionality of the fill() function of JavaScript. Syntax The basic syntax of the fill() function is mentioned below: array.fill(val, start, end) Let's understand the parameters used in the fill() function. ... Read More

364 Views
The find() method of JavaScript is used to return the first elements value in an array, if the condition is passed, otherwise the return value is undefined. The syntax is as follows −array.find(function(val, index, arr), thisValue)Here, function is a function with val, which is the value of the current element. The index is the array index, and arr is the array. The this value parameter is the value to be passed to the function.Example Live Demo Ranking Points Get the points (first element) above 400... Result var pointsArr = ... Read More

1K+ Views
Object literals and constructors both are used to create an Object in JavaScript. An object created by the object literals is a singleton. This means when a change is made to the object, it affects that object across the entire script. If an object created by a function constructor has multiple instances of the object. This means the changes made to one instance, will not affect other instances. Object Literal Notation − Let’s create user details where we have the key, name, age, and name of the company. So we are creating an object named userDetails. const userDetails = {name: "Aman", ... Read More

2K+ Views
Whenever an Express application server receives an HTTP request, it will provide the developer with an object, commonly referred to as res. For example, Exampleapp.get('/test', (req, res) => { // use req and res here })The res object basically refers to the response that'll be sent out as part of this API call.The res.send function sets the content type to text/Html which means that the client will now treat it as text. It then returns the response to the client.The res.json function on the other handsets the content-type header to application/JSON so that the client treats the response string ... Read More

1K+ Views
In computer programming, cloning refers to an object copied by a method or copy factory function often called clone and copy. The easiest way to clone an object except for one key would be to clone the whole object and then remove the property that is not required. Cloning, however, can be of 2 types − Deep Clone Shallow Clone Shallow Clone The shallow clone copies as little as possible. For example, a shallow copy of a collection might be a copy of the collection’s structure, not its elements. With a shallow copy, two collections now share individual ... Read More

453 Views
A local file is a .json file that contains a set of translations for the text strings used in a theme template file. A separate local file is used for every language.When you require moment.js in your code and pack it with webpack, the bundle size becomes huge because it includes all locale files.You can remove all locale files using the IgnorePlugin. For example, Exampleconst webpack = require('webpack'); module.exports = { plugins: [ // Ignore all locale files of moment.js new webpack.IgnorePlugin(/^\.\/locale$/, /moment$/), ], }; // load specific locales in your code. ... Read More

1K+ Views
Arrays can be compared in 2 ways −They refer to the same array object in memory.They may refer to different objects but their contents are all equal.For case 1, jasmine provides the toBe method. This checks for reference. For example, Exampledescribe("Array Equality", () => { it("should check for array reference equility", () => { let arr = [1, 2, 3]; let arr2 = arr // Runs successfully expect(arr).toBe(arr2); // Fails as references are not equal expect(arr).toBe([1, 2, 3]); }); });OutputThis ... Read More