---
title: "扩展prototype.js Object.deepExtend深度扩展"
author: "Nonkr"
date: "2013-07-29T23:08:06Z"
tags: []
categories: ["Web前端"]
slug: "prototype-js-object-deepextend"
draft: false
lastmod: "2013-07-29T23:08:06Z"
id: 1915265
url: "https://nonkr.iteye.com/blog/1915265"
---

```
Object.deepExtend = function(destination, source) {
  for (var property in source) {
    if (source[property] && source[property].constructor &&
     source[property].constructor === Object) {
      destination[property] = destination[property] || {};
      arguments.callee(destination[property], source[property]);
    } else {
      destination[property] = source[property];
    }
  }
  return destination;
};
```