Vineeth.mariserla has Published 117 Articles

What is the difference between Math.ceil() and Math.round() methods in JavaScript?

vineeth.mariserla

vineeth.mariserla

Updated on 30-Jul-2019 22:30:26

4K+ Views

Math.ceil() and Math.round() methods differ in a way that the former round off a number to its nearest integer in upward direction of rounding(towards the greater value) whereas the latter round off a number to its nearest integer in downward direction of rounding(towards lower value). Let's examine the two methods individually.Math.ceil()Math.ceil() ... Read More

What is the use of Array.entries() method in JavaScript?

vineeth.mariserla

vineeth.mariserla

Updated on 30-Jul-2019 22:30:26

136 Views

Array.entries()The Array.entries() in JavaScript is used to get a new Array that contains the key and value pairs for each index of an array. It returns an Array Iterator object with key/value pairs.syntaxarray.entries();ExampleIn the following example elements.entries() method, using for loop, access every element and generate key/value pair of the ... Read More

Explain JavaScript Bitwise NOT, Left shift and Right shift?

vineeth.mariserla

vineeth.mariserla

Updated on 30-Jul-2019 22:30:26

132 Views

JavaScript Bitwise NOT Live DemoExample document.getElementById("not").innerHTML = ~ 13; Output-14Explanation: It gives 0 for 1 and 1 for 0.The above result is 14.JavaScript Bitwise leftshift operator Live DemoExample document.getElementById("left").innerHTML = 5

What is the importance of _without() method in JavaScript?

vineeth.mariserla

vineeth.mariserla

Updated on 30-Jul-2019 22:30:26

236 Views

_without() This method is in the underscore.js library of javascript. It takes two parameters and removes, what are the elements present in the second array, from the first array. It doesn't bother whether the values are true or false, it checks each value one by one and proceeds the task. Make sure ... Read More

How to get the pixel depth and color depth of a screen in JavaScript?

vineeth.mariserla

vineeth.mariserla

Updated on 30-Jul-2019 22:30:26

474 Views

Javascript window object has provided many methods to get various kinds of information regarding the browser.  It has provided screen.colorDepth and screen.pixelDepth to get the color depth and pixel depth of browser screen respectively. Let's discuss them individually.Color depthThe window object has provided screen.colorDepth method to return the color depth. ... Read More

How to find duplicates in an array using set() and filter() methods in JavaScript?

vineeth.mariserla

vineeth.mariserla

Updated on 30-Jul-2019 22:30:26

1K+ Views

Removing duplicatesTo remove duplicates in an array we have many logical methods, but advanced javascript has provided some methods so that the task of removing duplicates has become very simple. Some of those methods are set() and filter(). For better understanding lets' discuss each method individually.Set()The important use of the ... Read More

Explain in detail about the memory life cycle of JavaScript?

vineeth.mariserla

vineeth.mariserla

Updated on 30-Jul-2019 22:30:26

273 Views

Memory cycleRegardless of the programming language, the memory cycle is almost same for any programming language. There are 3 steps in a memory life cycle1) Allocation of memory .2) use the allocated memory(reading or writing)3) Release the allocated memory when it is unnecessary.The first and last parts are directly connected in ... Read More

How to execute a cube of numbers of a given array in JavaScript?

vineeth.mariserla

vineeth.mariserla

Updated on 30-Jul-2019 22:30:26

1K+ Views

To find the cubes of elements of given array we need to run a for loop to access each and every element and we need to use "=" operator to replace elements with their cubes.To get the desired values the below steps need to be followed.Steps1) Declared an array a ... Read More

How to hide/show HTML elements in JavaScript?

vineeth.mariserla

vineeth.mariserla

Updated on 30-Jul-2019 22:30:26

1K+ Views

Using Css style we can hide or show HTML elements in javascript. Css provides properties such as block and none to hide/show the HTML elements.Hiding an elementExampleIn the following example when the "Hideme" button has clicked the text in the paragraph tag has been disappeared as shown in the output.Live Demo    Using JavaScript to ... Read More

How to get a part of string after a specified character in JavaScript?

vineeth.mariserla

vineeth.mariserla

Updated on 30-Jul-2019 22:30:26

12K+ Views

To get a part of a string, string.substring() method is used in javascript. Using this method we can get any part of a string that is before or after a particular character.str.substring() This method slices a string from a given start index(including) to end index(excluding). If only one index is provided ... Read More

Previous 1 ... 6 7 8 9 10 ... 12 Next
Advertisements