
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 6710 Articles for Javascript

3K+ Views
In this article we are going to learn how to replace a chils node with a new node in JavaScript with suitable examples. To replace a child node with a new node, there is an inbuilt method to replace the new node with the old node within a given parent node. The inbuilt methods are – replaceChild(), replaceWith(). The methods replaceChild(), replaceWith() are supported by all modern browsers and also they are features of DOM Level1. To understand this concept better, let’s look into the syntax and usage of replaceChild() and replaceWith() methods in JavaScript. Syntax The syntax for replaceChild() ... Read More

1K+ Views
In this article we are going to learn about the number of elements a particular tag contains in JavaScript with suitable examples. There are two possible ways to find the number of elements a particular tag contains in JavaScript. One of the possible way is to use the existing property childElementCount and the other way is to use the length property of JavaScript. To understand better, Let’s look into the examples which achieved the above task by using childElementCount and length property of JavaScript. Using the childElementCount property The childElementProperty will return the number of elements a particular id tag ... Read More

1K+ Views
In this article, we are going to discuss about the Built-in JavaScript constructors with appropriate examples in JavaScript. Javascript has provided some built-in constructors for native objects. These built-in functions include Object(), String(), Boolean(), RegExp(), Number(), Array(), Function(), Date(). Note We cannot include Math object in those built-in constructors because Math is a global object. The 'new' keyword cannot be used with Math. Let’s understand this concept in a better way with the help of examples further in this article. Example 1 This is an example program to illustrate about the inbuilt constructor String(). ... Read More

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(); Let's see the various ways to add ... Read More

862 Views
In this article, we’ll go over how to add a property to a JavaScript object constructor in JavaScript with appropriate examples. Adding a property to an object constructor is different from adding a property to a normal object. If we want to add a property, we have to add it in the constructor itself rather than outside the constructor whereas we can add anywhere in a normal object. To get a better understanding of the given task, let’s look into the syntax and usage of the constructor in JavaScript. Syntax The syntax for a constructor is − Constructor(); // No ... Read More

7K+ Views
In this article, we’ll go over how to add a method to a JavaScript object in JavaScript with appropriate examples. A JavaScript object is an entity which has properties. A property can be a variable or a method which define state and behavior of the object. A method is a property of an object that adds behavior to an object. We can add a method to a JavaScript object using object prototype. All JavaScript objects get their attributes and methods from a prototype. Let’s understand this concept better with the help of examples further in this article. Syntax The syntax ... Read More

2K+ Views
JavaScript is a lenient object-oriented language. We'll look at various JavaScript object creation methods in this article. It is crucial to know that JavaScript is an object-oriented language based on prototypes instead of classes before moving on. It can be more difficult to understand how JavaScript enables you to build hierarchies of objects and to get an inheritance of properties and their values because of this different foundation. Programming objects can combine variables, functions, and data structures. In other words, objects can hold values, you can use objects to manipulate values, and you can combine values into more complicated objects, ... Read More

540 Views
Property accessors offer dot notation or bracket notation-based access to an object's properties. Associative arrays are a good way to understand objects (a.k.a. map, dictionary, hash, lookup table). The names of the property names are the keys inside this array. A difference between properties and methods is frequently made when discussing an object's properties. But the distinction between a property and a technique is simply an established practice. When a property's value is a reference to an example of a Function, for example, that property can be invoked to perform a function. Syntax ObjectName[propertyName] You will study JavaScript getter ... Read More

26K+ Views
In this article we are going to learn how to encode a string in JavaScript with appropriate examples. Encoding is the process of converting from one data format to another format. In computer science terms, encoding is the process of converting a text into a cipher text. Encoding is different from the Encryption process. The difference between encoding and encryption is where the encoding is used to keep data usable and data confidentiality is maintained by encryption. Encoding does not use a key for encoding process whereas for encryption there should be a key for encryption process. The methods that ... Read More

4K+ Views
The user's current location can be found using the getCurrentPosition() method. The Geolocation API that HTML5 offers us allows us to know the user's geographic location. The Geolocation API provides the latitude and longitude of the user's current location, that are thereafter delivered to the backend via JavaScript and displayed on the website. The read-only longitude property of the GeolocationCoordinates interface is a double-precision floating point value that indicates a location's longitude, expressed in decimal degrees. The GeolocationCoordinates object is a component of the GeolocationPosition interface, since it is the object type delivered by Geolocation API calls which collect and ... Read More