Vineeth.mariserla has Published 140 Articles

What is global namespace pollution in JavaScript?

vineeth.mariserla

vineeth.mariserla

Updated on 29-Jun-2020 08:55:29

Global namespace pollutionPolluting Global namespace causes name collision. This name collision is very common in large projects where we may be using several javascript libraries. Let's discuss in detail what a name collision is.let's take a scenario in which 2 teams named A1 and A2 are working on a project. They ... Read More

What is function chaining in JavaScript?

vineeth.mariserla

vineeth.mariserla

Updated on 29-Jun-2020 08:40:24

Function chainingFunction chaining is nothing but grouping functions in one single line using dot notation. This type of chaining makes the code very concise and also improves the performance.Here we are going to learn function chaining using regular objects.a) Without function chaining In the following example an object 'obj' is created ... Read More

Regular functions vs Arrow functions in JavaScript?

vineeth.mariserla

vineeth.mariserla

Updated on 26-Aug-2019 15:49:36

Regular functions vs Arrow functionsAn arrow function is used to write the code concisely. Both functions regular and arrow work in a similar manner but there are some differences between them. Let's discuss those differences in a nutshell.syntax of an arrow functionlet x = (params) => { // code };syntax of a ... Read More

How to access a JavaScript object using its own prototype?

vineeth.mariserla

vineeth.mariserla

Updated on 26-Aug-2019 08:52:59

We can able to access the existing object by creating its own prototype using a javascript method called "Object.create()". Using this method we can inherit the properties from the existing properties to the newly created prototype. Let's discuss it in a nutshell.syntaxObject.create(existing obj);This method takes the existing object and creates ... Read More

JavaScript Sleep() function?

vineeth.mariserla

vineeth.mariserla

Updated on 26-Aug-2019 07:30:05

Sleep()With the help of Sleep() we can make a function to pause execution for a fixed amount of time. In programming languages such as C and Php we would call sleep(sec). Java has thread.sleep(), python has time.sleep() and GO has time.Sleep(2 * time.Second).javascript doesn't have these kinds of sleep functions. But we should thank promises and ... Read More

JavaScript's Boolean function?

vineeth.mariserla

vineeth.mariserla

Updated on 23-Aug-2019 15:17:10

Boolean functionWhile developing, a developer may come across yes/no situation. At that point of time Boolean() function can be used. It results only in true or false. Let's discuss it in detail.syntaxBoolean(exp);It takes an expression and scrutinizes it and displays either true or false based on the validity of the ... Read More

Object.assign() in JavaScript?

vineeth.mariserla

vineeth.mariserla

Updated on 20-Aug-2019 14:42:35

Object.assign()This method is used to copy one or more source objects to a target object. It invokes getters and setters since it uses both 'get' on the source and 'Set' on the target. It returns the target object which has properties and values copied from the target object. This method ... Read More

First element and last element in a JavaScript array?

vineeth.mariserla

vineeth.mariserla

Updated on 20-Aug-2019 08:19:15

An array is a group of elements. Each element has its own index value. We can access any element using these indexes. But in the case of the last element, we don't know the index until we know the number of elements present in the array. In this case, we have ... Read More

Push() vs unshift() in JavaScript?

vineeth.mariserla

vineeth.mariserla

Updated on 19-Aug-2019 13:58:49

push() vs unshift()The methods push() and unshift() are used to add an element in an array. But they have a slight variation. The method push() is used to add an element at the end of the array, whereas the method unshift() is used to add the element at the start ... Read More

Value of the class attribute node of an element in JavaScript?

vineeth.mariserla

vineeth.mariserla

Updated on 08-Aug-2019 14:37:37

Javascript has provided the getAttributeNode() method to find the attribute node with the specified name of an element, as an attribute object. If the attribute does not exist, the return value is null or an empty string ("").syntaxelement.getAttributeNode(attributename);It returns the attribute object representing the specified attribute node ExampleIn the following example, there are two heading ... Read More

Advertisements