Vineeth.mariserla has Published 117 Articles

What is the use of exec() regex method in JavaScript?

vineeth.mariserla

vineeth.mariserla

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

50 Views

exec()The exec() method is a regex method. It searches a string for a specified pattern and, unlike test() regex method, returns the found text as an object. If there are no matches it will give null as an output. Let's discuss it in detail.Example-1In the following example, a variable pattern ... Read More

What are the differences between mean.io and mean.js in javascript?

vineeth.mariserla

vineeth.mariserla

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

51 Views

Differences between Mean.io and Mean.jsThe MEAN is a stack framework. When combined with Mongodb, node.js, express.js and angular.js it helps to create a complete javascript web app. A software developer from Israel, Amos Haviv was the first person to initiate Mean.io. Mean.js is simply a fork out from Mean.io. When ... Read More

How to freeze an Object in JavaScript?

vineeth.mariserla

vineeth.mariserla

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

85 Views

In the Real time world javascript doesn't have traditional classes as seen in other languages. It has objects and constructors. Object.freeze() is one among many constructor methods helps to freeze an object.Freezing an object does not allow new properties to be added to the object and also prevents the object from ... Read More

How does JavaScript focus() method works?

vineeth.mariserla

vineeth.mariserla

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

1K+ Views

focus()Javascript focus() methods helps to highlight a HTML form element. It sets the element as an active element in the current document. In current documentation, focus can be applied to only one single element. The focus can be applied either to a text, a button, etc.  syntaxelement.focus(options);ExampleIn the following example, initially, ... Read More

What is the use of Math.hypot() function in JavaScript?

vineeth.mariserla

vineeth.mariserla

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

135 Views

Math.hypot()Math.Hypot() method is used to find the square root of the sum of the squares of the elements that are passed to it as arguments. This method is actually used to find the hypotenuse of a right-angle triangle whose sides are passed as arguments into it. syntaxMath.hypot(arg1, arg2, ....);ExampleIn the following ... Read More

What is the difference between for...in and for...of loops in JavaScript?

vineeth.mariserla

vineeth.mariserla

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

2K+ Views

Difference between for...in and for...of loopsBoth the loops iterate over something. The main difference between them is in what they iterate over.1) for...in loopThis loop iterates over enumerable properties of an object in an arbitrary order. It cares only about properties but not values.In the following example by using for...in ... Read More

What is the use of _.size() method in JavaScript?

vineeth.mariserla

vineeth.mariserla

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

509 Views

_.size()_.Size() is from the underscore.js library of javascript. This is used to find the size of an array. One should make sure that before using this method one should use the CDN of the underscore.js to execute the code.syntax_.size(array);Example-1In the following example, a normal array is passed into _.size() method to get ... Read More

What is the importance of _.initial() function in JavaScript?

vineeth.mariserla

vineeth.mariserla

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

317 Views

_.initial()_.initial() is a function in underscore.js, which is a library of javascript. This method is used to differentiate the last element of an array from the rest of the elements. This method just ignores the last value of an array.syntax_.initial( array, n );_.Initial() can take 2 parameters. array - The method takes ... Read More

How to deep flatten an array in JavaScript?

vineeth.mariserla

vineeth.mariserla

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

98 Views

Flattening an arrayFlattening an array is nothing but merging a group of nested arrays present inside a provided array. Flattening of an array can be done in two ways. 1) concat.apply() In the following example there are some nested arrays containing elements 3, 4, 5 and 6. After flattening them using concat() method ... Read More

How to empty an array in JavaScript?

vineeth.mariserla

vineeth.mariserla

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

690 Views

There are a couple of ways to empty an array in javascript.Let's suppose take an arrayvar array1 = [1, 2, 3, 4, 5, 6, 7];Method 1var array1 = [];The code above will set the number array to a new empty array. This is recommended when you don't have any references ... Read More

Advertisements