Ayush Gupta has Published 527 Articles

What are javascript sets?

Ayush Gupta

Ayush Gupta

Updated on 18-Sep-2019 11:57:00

229 Views

A set is an abstract data type that can store certain values, without any particular order, and no repeated values. It is a computer implementation of the mathematical concept of a finite set. Unlike most other collection types, rather than retrieving a specific element from a set, one typically tests ... Read More

What is the use of OBJECT.assign() in javascript?

Ayush Gupta

Ayush Gupta

Updated on 17-Sep-2019 08:55:08

307 Views

The Object.assign() method is used to copy the values of all of the object's own properties(enumerable only) from one or more source objects to a target object. It will return the target object.Exampleconst targetObj = { a: 1, b: 2 }; const sourceObj = { b: 4, c: 5 }; ... Read More

Eradicating Memory Leaks in Javascript

Ayush Gupta

Ayush Gupta

Updated on 17-Sep-2019 08:15:58

212 Views

The main cause for leaks in garbage collected languages are unwanted references. To understand memory leaks, let us see how the memory freeing(garbage collection) works.Mark-and-sweep algorithm −This algorithm reduces the definition of "an object is no longer needed" to "an object is unreachable". This algorithm assumes the knowledge of a ... Read More

How to avoid circular reference in OOP Javascript?

Ayush Gupta

Ayush Gupta

Updated on 17-Sep-2019 08:05:54

513 Views

A circular reference occurs if two separate objects pass references to each other.In older browsers circular references were a cause of memory leaks. With improvements in Garbage collection algorithms, which can now handle cycles and cyclic dependencies fine, this is no longer an issue.However, from a pure design point of ... Read More

Why circular reference is bad in javascript?

Ayush Gupta

Ayush Gupta

Updated on 17-Sep-2019 08:02:47

1K+ Views

A circular reference occurs if two separate objects pass references to each other.In older browsers circular references were a cause of memory leaks. With improvements in Garbage collection algorithms, which can now handle cycles and cyclic dependencies fine, this is no longer an issue.However, from a pure design point of ... Read More

Differences between web-garden and a web-farm in Javascript

Ayush Gupta

Ayush Gupta

Updated on 16-Sep-2019 08:52:25

438 Views

Web Garden is the web hosting system which comprises of multiple “processes”. This means that we have a single server on which we run multiple processes. This type of hosting provides logical scalability to our web applications.Web Farm is the web hosting system which comprises of multiple “computers”. This is ... Read More

Convert the string of any base to integer in JavaScript

Ayush Gupta

Ayush Gupta

Updated on 16-Sep-2019 08:19:08

180 Views

The parseInt function available in JavaScript has the following signature −parseInt(string, radix);Where, the paramters are the following −String − The value to parse. If this argument is not a string, then it is converted to one using the ToString method. Leading whitespace in this argument is ignored.Radix − An integer ... Read More

What is "undefined x 1" in JavaScript?

Ayush Gupta

Ayush Gupta

Updated on 16-Sep-2019 08:03:51

197 Views

This is not a feature of JavaScript but is Chrome's way of displaying uninitialized indexes in arrays (and array-like objects). For example, if you console.log the following −Exampleconsole.log(Array(100))Output[undefined × 100]This is better than printing [undefined, undefined, undefined,...] as it is more readable.

Why is javascript called Richer Interface?

Ayush Gupta

Ayush Gupta

Updated on 16-Sep-2019 07:40:36

227 Views

JavaScript allows you to add very advanced features to your web applications. For example, Drawing and manipulating graphicsAudio and Video APIs like HTMLMediaElement, the Web Audio API, and WebRTC allow you to do really interesting things with multimedia such as creating custom UI controls for playing audio and video, displaying ... Read More

Difference between regular functions and arrow functions in JavaScript

Ayush Gupta

Ayush Gupta

Updated on 16-Sep-2019 07:36:51

820 Views

According to MDN, An arrow function expression is a syntactically compact alternative to a regular function expression, although without its own bindings to the this, arguments, super, or new.target keywords. Arrow function expressions are ill suited as methods, and they cannot be used as constructors.There are 3 subtle differences in ... Read More

Advertisements