Three ways to make object immutable: 1. Use JSON.parse(JSON.stringify(obj)): this approach is little bit expense. 2. Use Object.create() var person = { name: "Wan" } var copyPerson = Object.create(person); console.log(copyPerson.name); //Wan Thi…
JavaScript Math Object Math Object The Math object allows you to perform mathematical tasks. Math is not a constructor. All properties/methods of Math can be called by using Math as an object, without creating it. Syntax var x = Math.PI; // Returns P…
javascript nested object merge deep copy Object reference type function namespace(oNamespace, sPackage) { // deep copy let res = oNamespace; const arr = sPackage.split("."); // ["a", "b", "c", "d"] const…