1) x=10; console.log(x); var x=0; output:10 2) WeakMap A WeakMap is a built-in JavaScript data structure introduced in ECMAScript 6 (ES6) that allows you to create a collection of key-value pairs where keys are objects and values can be arbitrary data. Unlike Map, keys in a WeakMap are weakly referenced, meaning they don't prevent their associated objects from being garbage collected when no other references to them exist. Here's a brief overview of WeakMap: Usage: WeakMap is used when you want to associate metadata or additional information with objects without preventing those objects from being garbage collected when they're no longer needed elsewhere in your code. Key Characteristics: Keys must be objects (primitive data types like numbers or strings are not allowed as keys). Values can be any type of data. Keys in a WeakMap are weakly referenced, meaning they don't prevent garbage collection of their associated objects. If an object used as a key in a WeakMa...
This website contains interview questions for JavaScript, Nodejs, Html, Css, Datastructure, Mongodb, Angular, Aws and much more intresting articles on different technologies.