Vineeth.mariserla has Published 229 Answers

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

Execute digits in even places in a JavaScript array?

vineeth.mariserla

vineeth.mariserla

Updated on 20-Aug-2019 13:26:02

To access the numbers from the even places, rather than looping through the numbers, loop through the places i.e indexes. If we loop through the numbers, other than the elements in the even places, even numbers will be accessed. ExampleIn the following example, a for- loop is used to loop through all ... 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

How "getElementByID" works in JavaScript?

vineeth.mariserla

vineeth.mariserla

Updated on 19-Aug-2019 16:03:04

getElementByIdThe getElementById() is a DOM method used to return the element that has the ID attribute with the specified value. This is one of the most common methods in the HTML DOM and is used almost every time we want to manipulate an element on our document. This method returns null if no elements with ... 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

Replace a child node with a new node in JavaScript?

vineeth.mariserla

vineeth.mariserla

Updated on 19-Aug-2019 07:48:45

To replace a child node with new node javascript has provided a method called "replaceChild()". To achieve this task at first we have to create a new node and then by using replaceChild(), we should replace the old node with new node.syntaxnode.replaceChild(newnode, oldnode);It takes two parameters i.e old and new nodes and replaces the ... Read More

Insert a specified element in a specified position in JavaScript?

vineeth.mariserla

vineeth.mariserla

Updated on 09-Aug-2019 15:27:50

Javascript has provided "insertAdjacentElement()" to insert an already existing element in a specified position. If there are multiple elements with the same name then use indexes to access them as we access the array elements. syntaxnode.insertAdjacentHTML(position, element);Example-1In the following example, there are actually 3 elements in parallel span1, span2, and header. Using ... Read More

First and last child node of a specific node in JavaScript?

vineeth.mariserla

vineeth.mariserla

Updated on 09-Aug-2019 13:38:42

To get the first and last child nodes of a specific node, javascript has provided firstChild and lastChild methods respectively. let's discuss them in a nutshell.FirstChildsyntaxnode.firstChild;ExampleIn the following example, there are three elements in the list node. Using the method "firstChild" the first element is found out and the result ... Read More

Remove the child node of a specific element in JavaScript?

vineeth.mariserla

vineeth.mariserla

Updated on 09-Aug-2019 12:39:39

To remove the child node of a list javascript has provided removeChild() method. Using this method we can remove any list item using its index position. Let's discuss it in a nutshell.syntaxnode.removeChild(node);Example-1In the following example, there are 3 elements in the provided list but after removing a child there are ... Read More

Advertisements