/**
* Params {Object}
*
*/
function deepClone(obj) {
  if(typeofobj ! = ='object' || obj == null) {
      return obj
  }
  
  // Define the function return value
  let result
  if(obj instanceof Array) {
      result = []
  } else {
      result = {}
  }
  
  for(let key in obj) {
      if(obj.hasOwnProperty(key)) { result[key] = deepClone(obj[key]); }}return result
}
Copy the code