Vineeth.mariserla has Published 229 Answers

How to access a function property as a method in JavaScript?

vineeth.mariserla

vineeth.mariserla

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

Accessing a function as a method A javascript object is made up of properties. To access a property as a method, just define a function to a property and include other properties in that function.In the following example an object called "employee" is created with properties "fullName", "lastName" , "firstName" and ... Read More

What is Event Capturing in JavaScript?

vineeth.mariserla

vineeth.mariserla

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

Event CapturingEvent capturing is the event starts from top element to the target element. It is the opposite of Event bubbling, which starts from target element to the top element.Code ElaborationIn the following code, in body section three div elements are taken and a style got applied so as to ... Read More

How to hide e-mail address from an unauthorized user in JavaScript?

vineeth.mariserla

vineeth.mariserla

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

Hiding an e-mail addressThe following steps are to be followed to hide our e-mail from unauthorized users. In every email address '@' symbol is common so try to remove it from the email address using split() method. In the following example after splitting the email(batman@gmail.com) we get the result as batman, gmail.com.Divide ... Read More

How to check if a variable is an array in JavaScript?

vineeth.mariserla

vineeth.mariserla

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

In javascript we can check whether a variable is array or not by using three methods.1) isArray() methodThe Array.isArray() method checks whether the passed variable is array or not. If the variable is an array it displays true else displays false.SyntaxArray.isArray(variableName)ExampleLive Demo<html> <body> <script type="text/javascript"> arr = ... Read More

What is the use of Map in JavaScript?

vineeth.mariserla

vineeth.mariserla

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

MapMap holds key value pairs and remembers the actual insertion order of the keys. Map allows to store only a unique value.syntaxnew Map([iterable])Case-1: Absence Of MapIn the absence of Map, since javascript object endorses only one key object, If we provide multiple keys only the last one will be remembered. ... Read More

Explain the importance of Array.filter() method in JavaScript with example?

vineeth.mariserla

vineeth.mariserla

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

Array.filter()Array.filter() method creates a new array with all the elements that have passed the test implemented by the provider function(function given by the user).In the following example the test is whether the given salary elements are more than a particular value(19000) given by the user().Example-1Live Demo<html> <body> <p id="filter"></p> <script> ... Read More

How to remove non-word characters in JavaScript?

vineeth.mariserla

vineeth.mariserla

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

Removing non-word charactersTo remove non-word characters we need to use regular expressions. The logic behind removing non-word characters is that just replace the non-word characters with nothing('').ExampleIn the following example there are many non-word characters and in between them there exists a text named "Tutorix is the best e-learning platform". ... Read More

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

vineeth.mariserla

vineeth.mariserla

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

Array.Reduce()The Array.Reduce() method executes the provided function(given by the user) to each element of the array, there by giving single output.In the given example, the provided function(function provided by user is addition) executes on each element of the array(1, 2, 3, 4) there by returning a single output (10).Example Live Demo<html> ... Read More

How to decode an encoded string in JavaScript?

vineeth.mariserla

vineeth.mariserla

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

DecodingIn JavaScript, to decode a string unescape() method is used. This method takes a string, which is encoded by escape() method, and decodes it. The hexadecimal characters in a string will be replaced by the actual characters they represent using unescape() method.Syntaxunescape(string)ExampleIn the following the two exclamation marks have converted ... Read More

Advertisements