Skip to content

Instantly share code, notes, and snippets.

'use strict'
const deepClone = (obj) => {
let copyObj
// if arg is primitive return
if (Object(obj) !== obj) return obj
copyObj = obj.constructor()
for (let key in obj) {
if (!obj.hasOwnProperty(key)) continue