Skip to main content

Posts

Showing posts from September, 2020

Javascript interview questions set 2

For set 1 please refer to the  Javascript interview question set 1. Let's begin with set 2, 3)What is the difference between Object.seal() and Object.freeze() in JavaScript? Object.seal() method protects the deletion of an existing property  but it can't protect the existing properties from outside changes.  var object1 = {       prop1: 1   };   Object.seal(object1);   object1.prop1 = 2; // value got changed   delete object1.prop1;   console.log(object1)   //It will show value of prop1=2.    We can't delete the property. It can just be modified. In addition to the functionalities of Object.seal(), The Object.freeze() method even won't allow minute changes to the existing properties of an object.  var object1 = {       prop1: 1   };  Object.freeze(object1);  object1.prop1 = 2;   delete object1.prop1;  console.log(object1)  It will show the value of prop1=1.   We can't delete any property or modify any property. 4)What is negative infinity? The negative infinity in Ja