Loading images on the web has always been a hot topic. If a user doesn’t see all your images, it doesn’t make sense to send down the wire all those extra bytes. All the techniques used to lazy load images in…
Here is the JS code to find out if a given element on the DOM is completely visible in the browser window viewport or not:
function Eg() { this.name = 10; return 'adarsh';}
new Eg(); // Returns {name: 10}However, if you return a object inside a constructor function, that object will be returned.
function Eg() { this.name = 10; return {…
Imagine you have the following block of code.
Consider the following code:
function Parent() {}
Parent.prototype.display = function() { console.log('Parent');}
function Child() {}
An abstract class is a ‘class’ that is used just for inheritance. We should not be creating objects directly from abstract classes.
Here is the code:
function Car(name) { if(this.constructor === Car) {…