How do you clone an object? Javascript object clone
Javascript object clone Now the value of objclone is {a: 1 ,b: 2} but points to a different object than obj. Note the potential pitfall, though: Object.assign() will just do a shallow copy, not a deep copy. This means that nested objects aren’t copied. They still refer to the same nested objects as the original:
What is a “closure” in JavaScript? Provide an example of closure
A closure is an inner function that has access to the variables in the outer (enclosing) function’s scope chain. example: