Posts

Showing posts from February, 2021

JavaScript Object-Advanced Concept- Questionnaire

 1. What is the differences of objects versus primitives?  The fundamental difference is objects are stored and copied "by reference"  where as primitive values: strings, numbers, booleans etc  are always copied "as a whole value". 2. Is it possible to create a "real copy" in JavaScript ?   Yes , we can use Object.assign for so called "shallow copy" . Nested object are copied by using _.cloneDeep(obj) function provided by load ash. 3. In regards to memory management in JavaScript , what happens when some thing is not needed any more?  The main concept of memory management in JavaScript is reachability. There is a background process in the JavaScript engine that is called garbage collector. It monitors all objects and removes those that have become unreachable. Only incoming ones make an object reference. 4. Can functions be stored as  object properties in JavaScript? Yes . The functions can be stored as properties and are called as methods. 5. ...

JavaScript Object-Basics - Questionnaire

Image
1 .Why is the last property be followed by a comma in JavaScript ?   The last property in JavaScript  can end with a comma (,). This can be called a "trailing" or "hanging" comma. Makes it easier to add/remove/move around properties , because all lines become alike . 2. What are the different ways to create an object in JavaScript ? let user = new Object(); let user = {}; 3. What are the different way to access a property in object in JavaScript? Properties are access with dot(.) and square brackets ([ ]). Dot Access           : user.name Square Bracket    : user["is Employed"]  4. How can we add a multiword property in JavaScript ?  Multi word can be used for property names but must be quoted. 5. How to delete a property from an object in JavaScript  with multi word and simple word property name?  Multi-Word      :      delete user["is Employed"]   Simple-Word     : ...