1
hwh
2024-06-03 f03b5c7ea42074b0aa6f6836301f20deefb64813
HTML_09/js/public.js
@@ -264,4 +264,21 @@
      });
    });
  }  
}
}
//深拷贝
function deepClone(source) {
  if (typeof source !== 'object' || source == null) {
    return source;
  }
  const target = Array.isArray(source) ? [] : {};
  for (const key in source) {
    if (Object.prototype.hasOwnProperty.call(source, key)) {
      if (typeof source[key] === 'object' && source[key] !== null) {
        target[key] = deepClone(source[key]);
      } else {
        target[key] = source[key];
      }
    }
  }
  return target;
}