
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

7K+ Views
The RegExp.prototype.test() and RegExp.prototype.exec() methods are the methods in JavaScript used to handle regular expressions. In addition to these two JavaScript includes a number of built-in methods for manipulating and processing text using regular expressions. What are regular expressions? Regular expressions are patterns that are used to search for character combinations in a string. Regular expressions are treated as objects in JavaScript and are denoted by either "regex" or "RegExp." The exec() method The exec() method makes a search for the specified match of the string in the given string. If the match of the string is present in the ... Read More

1K+ Views
The Instanceof operator in JavaScript checks for the type of object at the run time environment. The result it returns is of Boolean type i.e., if the given input object is same as the object for which it is being checked, then it returns “true” or else it returns “false”. Syntax The syntax of Instanceof operator is shown below − var myVar = nameOfObject instanceof typeOfObject Instanceof operator is used in JavaScript for a unique purpose. As in JavaScript some of the variables are declared without mentioning the type of variable or the data type. In C, C++, Java ... Read More

177 Views
This is not a feature of JavaScript but is Chrome's way of displaying uninitialized indexes in arrays (and array-like objects). For example, if you console.log the following −Exampleconsole.log(Array(100))Output[undefined × 100]This is better than printing [undefined, undefined, undefined,...] as it is more readable.

289 Views
Array is a data type which can store multiple elements of similar data types. For example, if an array is declared as integer data type then it stores one or more elements of the integer data type. To check if the given object or to know the data type, we can use directly the typeof() method in JavaScript. Using typeof() method typeof() is a function which gives the type of the given object. The typeof() will return a string which is the data type of the given operand. The operand can be an object, a variable or a function. For ... Read More

24K+ Views
There are multiple ways to clear/empty an array in JavaScript. You need to use them based on the context. Let us look at each of them. Assume we have an array defined as − let arr = [1, 'test', {}, 123.43]; Substituting with a new array − arr = []; This is the fastest way. This will set arr to a new array. This is perfect if you don't have any references from other places to the original arr. If you do, those references won't be updated and those places will continue to use the old array. Setting length prop ... Read More

406 Views
Using private methods has a simple underlying concept. In this situation, you can declare private methods or private properties, which are used to hide a class's internal functionality from those other classes, whenever you wish to keep something private, whether it be a method or a property. You can include private fields, static methods, instance methods, and getters and setters that are only accessible to you. Truly private fields and methods are delivered through private class features, with the language maintaining that privacy rather than a custom. Benefits include preventing naming conflicts between class features and the other of the ... Read More

354 Views
This article discusses about how do you test if a value is equal to NaN in JavaScript. In JavaScript, NaN is a method from Number class. NaN implies Not-a-Number. It is of Boolean type. It returns true when the value is “Not-a-number”. The NaN method is used in the situations. For example, when a function tries to parse a number and it fails or when a math function fails, the method NaN is used. The syntax for isNaN() method is shown below. isNaN(); or Number.isNaN(); There is a difference between isNaN() and Number.isNaN(). If the value is currently NaN ... Read More

1K+ Views
In this article, we are going to discuss about the quickest language between JavaScript and ASP script. JavaScript is a light weighted and compiled language. It is a popular client-side scripting language. The content of JavaScript code is visible to the users. The extension for a JavaScript file is .js. Active Server Pages Script is popularly known as ASP script. It is a server-side scripting language to develop dynamic web pages. The extension for an ASP script file is .asp. Consider a Three-tier architecture – Presentation layer, Application layer and Data layer. JavaScript is used in the presentation layer. JavaScript ... Read More

205 Views
JavaScript allows you to add very advanced features to your web applications. For example, Drawing and manipulating graphicsAudio and Video APIs like HTMLMediaElement, the Web Audio API, and WebRTC allow you to do really interesting things with multimedia such as creating custom UI controls for playing audio and video, displaying text tracks like captions and subtitles along with your videos, grabbing video from your web camera to be manipulated via a canvas (see above) or displayed on someone else's computer in a web conference, or adding effects to audio tracks (such as gain, distortion, panning, etc).Device APIs are basically APIs ... Read More

778 Views
According to MDN, An arrow function expression is a syntactically compact alternative to a regular function expression, although without its own bindings to the this, arguments, super, or new.target keywords. Arrow function expressions are ill suited as methods, and they cannot be used as constructors.There are 3 subtle differences in regular functions and arrow functions in JavaScript.No own this bindingsArrow functions do not have their own this value. The value of this inside an arrow function is always inherited from the enclosing scope.Examplethis.a = 100; let arrowFunc = () => {this.a = 150}; function regFunc() { this.a = 200; ... Read More