Vineeth.mariserla has Published 278 Answers

Retrieve element from local storage in JavaScript?

vineeth.mariserla

vineeth.mariserla

Updated on 06-Aug-2020 10:12:46

To retrieve an element from the local storage we have to check whether the browser endorses the local storage or not. Later, we have to set an element in the local storage. At this moment we have to be careful because once the browser is closed, no data will be stored in ... Read More

Explain in detail about Mark and Sweep algorithm in JavaScript?

vineeth.mariserla

vineeth.mariserla

Updated on 04-Jul-2020 15:01:53

Mark and Sweep algorithmMark and Sweep algorithm looks out for objects 'which are unreachable' rather than objects 'which are no longer needed'. This algorithm is the improvement of Reference-counting algorithm.This algorithm actually goes through 3 important steps. Root: In general, a root is a global variable that is used in the ... Read More

Explain in detail about memory leaks in JavaScript?

vineeth.mariserla

vineeth.mariserla

Updated on 04-Jul-2020 14:46:34

Memory leaks in JavaScriptJavaScript is called garbage collected language,  that is when variables are declared, it will automatically allocate memory to them. When there are no more references for the declared variables, allocated memory will be released. Memory leaks or most of the memory related problems will occur while releasing ... Read More

Add a method to a JavaScript object constructor?

vineeth.mariserla

vineeth.mariserla

Updated on 03-Jul-2020 08:27:52

Adding a method to an object constructor is unlike adding a method to a normal object. We cannot add a method as it is the case with a normal object. To make a method in an object constructor it has to be added inside the object constructor.ExampleIn the following example, the method is ... Read More

Add a property to a JavaScript object constructor?

vineeth.mariserla

vineeth.mariserla

Updated on 03-Jul-2020 08:16:34

Adding a property to an object constructor is different from adding a property to a normal object. If we want to add a property we have to add it in the constructor itself rather than outside the constructor whereas we can add anywhere in a normal object.Example-1In the following example, a ... Read More

Create many JavaScript objects as the same type?

vineeth.mariserla

vineeth.mariserla

Updated on 03-Jul-2020 08:09:22

It is very easy to create a single object than to create multiple objects of the same type. To breach this hurdle, javascript has provided object constructor function. Using this function, initially, we have to create the type of the object and later on, we need to declare the properties of ... Read More

How to encode a string in JavaScript?

vineeth.mariserla

vineeth.mariserla

Updated on 03-Jul-2020 07:43:05

Javascript has provided escape() function to encode a string. But since the escape() function is now deprecated, it is better to use encodeURI() or encodeURIComponent(). syntax-1escape(string);syntax-2encodeURIComponent(str);Example-1In the following example, using the escape() method the string "Tutorix is the best e-learning platform!!!" is encoded and displayed the result in as shown in the output.Live Demo<html> <body> ... Read More

How to decode a string after encoding in JavaScript?

vineeth.mariserla

vineeth.mariserla

Updated on 03-Jul-2020 07:41:23

To encode a string we need encodeURIComponent() or encodeURI() and to decode a string we need decodeURIComponent() or decodeURI(). Initially, we have used escape() to encode a string but since it is deprecated we are now using encodeURI().syntax-1encodeURIComponent(string);syntax-2decodeURIComponent(string);ExampleIn the following example, initially, a string is taken and encoded using encodeURI() and later decoded using decodeURI(). ... Read More

How to check whether a number is finite or not in JavaScript?

vineeth.mariserla

vineeth.mariserla

Updated on 02-Jul-2020 14:50:01

Javascript has provided isFinite() method to check whether the given entity is a legal number or not. If the given entity is a number, regardless of string for instance "123", this method will result in boolean true, else returns false. Let's discuss it in a nutshell.syntaxisFinite(value);This method takes a value ... Read More

getters and setters in JavaScript classes?

vineeth.mariserla

vineeth.mariserla

Updated on 02-Jul-2020 12:55:18

Classes allow using getters and setters. It is smart to use getters and setters for the properties, especially if you want to do something special with the value before returning them, or before you set them. To add getters and setters in the class, use the get and set keywords.Example In the following example, getters and setters were added to ... Read More

1 2 3 4 5 6 7 ... 28 Next
Advertisements