
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

4K+ Views
To declare a variable in javascript we can use var, let or const keyword. Earlier var was only way to declare variable in javascript.In ES6, let and const keywords were introduced as a better way to declare variables. Now it is advised to use let instead of var to declare a variable. In this article we will be understanding the differences between var and let in Javascript. We will be differentiating between let and var based on the features mentioned in the table: ... Read More

2K+ Views
Both TypeScript and JavaScript are used at the client-end for processing the server requests and rendering data on UI. Both are scripting languages, however Typescript supports some additional features, due to which it is sometimes regarded as the superset of JavaScript. Read through this article to find out more about TypeScript and JavaScript and how these two languages are different from each other. What is JavaScript? JavaScript is most often used as a component of webpages. Its webpage implementations enable client-side script to interact with the user and create dynamic sites. It is a programming language that is ... Read More

966 Views
Java Script Object Notation is one of the many standard formats to store data in different many applications. JavaScript objects can also be stored in a file in this JSON format. In this article, we will cover a few methods to print the JSON objects in a pretty method. Let us see this as an example. We are creating an object in javascript before − Example (Creating Javascript Object)

11K+ Views
In JavaScript an object is found to be in the form of key value pairs. The keys of the objects are known as properties of the given object and is represented using a string. The property of the object can have a value which can be of any data type. For example, if an employee object is created then it has the properties like employee name, employee id, employee age, salary etc. These are the properties of the employee object which are called keys. The values of these properties will be different for different employees. In case of array, the ... Read More

2K+ Views
Javascript asynchronous programming uses a promise object which does not block the execution of the current flow but informs the compiler that there is something that is not completed yet, and whenever it completes it returns a signal to the system. There are mainly two possibilities. Either the promise object will complete successfully, or it will stop by returning an exception. To handle exceptions coming from promise objects the catch() methods are used. In try-catch methods also we can use another block named ‘finally’. This will execute no matter what is done previously. For promises also we can use the ... Read More

447 Views
Asynchronous programming is fairly common in javascript network programming. In this approach, we can download, or perform some time-dependent jobs without locking thecurrent execution flow. Which performs asynchronously as compared to our program, which can be done using async functions in javascript. In this article, we will discuss the techniques to return the response from an asynchronous call in javascript. Before entering into the concept, let us see in which cases it becomes confusing to developers when asynchronous execution calls are taken into action. Let us see the following situation. Syntax function aTrivialFunction() { ajaxCall(..., function onSuccess(result) ... Read More

235 Views
JavaScript classes, introduced in ES6, are syntactical sugar over JavaScript prototype-based inheritance. Classes are in fact "special functions". You can define classes in JavaScript using the class keyword using the following syntax −class Person { // Constructor for this class constructor(name) { this.name = name; } // an instance method on this class displayName() { console.log(this.name) } }This is essentially equivalent to the following declaration −let Person = function(name) { this.name = name; } Person.prototype.displayName = function() { console.log(this.name) }This class can also be written as ... Read More

3K+ Views
Multiple-inheritance is not supported by Javascript by default. But sometimes we need to mix multiple object properties into a single object. Object property sharing can be done using mixins. In this article, we shall cover what are mixins in JavaScript. The definition of mixins can be stated as mixins is a class that contains methods that can be used by other classes without inheriting from that class. The methods in mixin provide certain behavior which is not used alone but can be used to add these behaviors to other classes. Mixin: A Simple Example See the following example where we ... Read More

247 Views
The \W metacharacter is used to find a non-word character.A word character is a character from a-z, A-Z, 0-9, including the _ (underscore) character.Example// Containing any non word character: console.log(/\W/.test(" ")) console.log(/\W/.test(".!@#")) // Not containing non word characters: console.log(/\W/.test("a")) console.log(/\W/.test("B")) console.log(/\W/.test("9")) console.log(/\W/.test("_"))Outputtrue true false false false false

135 Views
The \s metacharacter is used to find a whitespace character.A whitespace character can be −A space characterA tab characterA carriage return characterA new line characterA vertical tab characterA form feed characterExample// Not containing any white spaces: console.log(/\s/.test("1")) console.log(/\s/.test("test")) // Containing whitespace characters: console.log(/\s/.test(" ")) console.log(/\s/.test("a\tb")) console.log(/\s/.test("mn"))Outputfalse false true true true