{"action":"closed","issue":{"url":"https://api.github.com/repos/crystalwm/javascript_new/issues/25","labels_url":"https://api.github.com/repos/crystalwm/javascript_new/issues/25/labels{/name}","comments_url":"https://api.github.com/repos/crystalwm/javascript_new/issues/25/comments","events_url":"https://api.github.com/repos/crystalwm/javascript_new/issues/25/events","html_url":"https://github.com/crystalwm/javascript_new/issues/25","id":122244513,"number":25,"title":"【数组】数组的深层赋值","user":{"login":"crystalwm","id":7902025,"avatar_url":"https://avatars.githubusercontent.com/u/7902025?v=3","gravatar_id":"","url":"https://api.github.com/users/crystalwm","html_url":"https://github.com/crystalwm","followers_url":"https://api.github.com/users/crystalwm/followers","following_url":"https://api.github.com/users/crystalwm/following{/other_user}","gists_url":"https://api.github.com/users/crystalwm/gists{/gist_id}","starred_url":"https://api.github.com/users/crystalwm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/crystalwm/subscriptions","organizations_url":"https://api.github.com/users/crystalwm/orgs","repos_url":"https://api.github.com/users/crystalwm/repos","events_url":"https://api.github.com/users/crystalwm/events{/privacy}","received_events_url":"https://api.github.com/users/crystalwm/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-12-15T10:48:24Z","updated_at":"2015-12-15T10:48:51Z","closed_at":"2015-12-15T10:48:51Z","body":"```javascript\r\nvar levelOrder = function(root) {\r\n    var temp=[],node;\r\n\r\n    if(root==null){\r\n        return [];\r\n    }\r\n\r\n    var queue=[];\r\n    queue.push(root);\r\n    var res=[];\r\n    res.push([root.val]);\r\n\r\n    while(queue.length>0){\r\n        temp=[];\r\n        while(queue.length>0){\r\n            node=queue.shift();\r\n            if(node.left!=null){\r\n                temp.push(node.left.val);\r\n            }\r\n            if(node.right!=null){\r\n                temp.push(node.right.val);\r\n            }\r\n        }\r\n\r\n        if(temp.length>0){\r\n            res.push(temp);\r\n        }\r\n\r\n        queue=temp;\r\n    }\r\n\r\n    return res;\r\n\r\n};\r\n```\r\n\r\n  res.push(temp); 和 node=queue.shift(); 操纵的是同一个数组\r\n"}}