{"action":"created","issue":{"url":"https://api.github.com/repos/Advanced-Frontend/Daily-Interview-Question/issues/102","repository_url":"https://api.github.com/repos/Advanced-Frontend/Daily-Interview-Question","labels_url":"https://api.github.com/repos/Advanced-Frontend/Daily-Interview-Question/issues/102/labels{/name}","comments_url":"https://api.github.com/repos/Advanced-Frontend/Daily-Interview-Question/issues/102/comments","events_url":"https://api.github.com/repos/Advanced-Frontend/Daily-Interview-Question/issues/102/events","html_url":"https://github.com/Advanced-Frontend/Daily-Interview-Question/issues/102","id":435558928,"node_id":"MDU6SXNzdWU0MzU1NTg5Mjg=","number":102,"title":"第 59 题：给定两个数组，写一个方法来计算它们的交集。 ","user":{"login":"zeroone001","id":9162197,"node_id":"MDQ6VXNlcjkxNjIxOTc=","avatar_url":"https://avatars3.githubusercontent.com/u/9162197?v=4","gravatar_id":"","url":"https://api.github.com/users/zeroone001","html_url":"https://github.com/zeroone001","followers_url":"https://api.github.com/users/zeroone001/followers","following_url":"https://api.github.com/users/zeroone001/following{/other_user}","gists_url":"https://api.github.com/users/zeroone001/gists{/gist_id}","starred_url":"https://api.github.com/users/zeroone001/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zeroone001/subscriptions","organizations_url":"https://api.github.com/users/zeroone001/orgs","repos_url":"https://api.github.com/users/zeroone001/repos","events_url":"https://api.github.com/users/zeroone001/events{/privacy}","received_events_url":"https://api.github.com/users/zeroone001/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":91,"created_at":"2019-04-21T23:44:31Z","updated_at":"2019-07-24T05:26:01Z","closed_at":null,"author_association":"NONE","body":"> 例如：给定 nums1 = [1, 2, 2, 1]，nums2 = [2, 2]，返回 [2, 2]。\r\n\r\n```javascript\r\nvar nums1 = [1, 2, 2, 1], nums2 = [2, 2, 3, 4];\r\n// 1.\r\n// 有个问题， [NaN].indexOf(NaN) === -1\r\nvar newArr1 = nums1.filter(function(item) {\r\n     return nums2.indexOf(item) > -1;\r\n});\r\nconsole.log(newArr1);\r\n// 2.\r\nvar newArr2 = nums1.filter((item) => {\r\n     return nums2.includes(item);\r\n});\r\nconsole.log(newArr2);\r\n```"},"comment":{"url":"https://api.github.com/repos/Advanced-Frontend/Daily-Interview-Question/issues/comments/514484769","html_url":"https://github.com/Advanced-Frontend/Daily-Interview-Question/issues/102#issuecomment-514484769","issue_url":"https://api.github.com/repos/Advanced-Frontend/Daily-Interview-Question/issues/102","id":514484769,"node_id":"MDEyOklzc3VlQ29tbWVudDUxNDQ4NDc2OQ==","user":{"login":"liuwenai","id":44860386,"node_id":"MDQ6VXNlcjQ0ODYwMzg2","avatar_url":"https://avatars3.githubusercontent.com/u/44860386?v=4","gravatar_id":"","url":"https://api.github.com/users/liuwenai","html_url":"https://github.com/liuwenai","followers_url":"https://api.github.com/users/liuwenai/followers","following_url":"https://api.github.com/users/liuwenai/following{/other_user}","gists_url":"https://api.github.com/users/liuwenai/gists{/gist_id}","starred_url":"https://api.github.com/users/liuwenai/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/liuwenai/subscriptions","organizations_url":"https://api.github.com/users/liuwenai/orgs","repos_url":"https://api.github.com/users/liuwenai/repos","events_url":"https://api.github.com/users/liuwenai/events{/privacy}","received_events_url":"https://api.github.com/users/liuwenai/received_events","type":"User","site_admin":false},"created_at":"2019-07-24T05:26:01Z","updated_at":"2019-07-24T05:26:01Z","author_association":"NONE","body":"let arr1 = [1, 4, 2, 4, 7]\r\nlet arr2 = [1, 4, 4, 234, 89, 6, 7]\r\nlet arr = [];\r\nfor (let i = 0; i < arr1.length; i++) {\r\n    for (let j = 0; j < arr2.length; j++) {\r\n        if (arr1[i] == arr2[j]) {\r\n            arr.push(arr1[i])\r\n            arr2.splice(j, 1)\r\n        }\r\n    }\r\n}\r\nconsole.log(arr)\r\n"}}
{"actor":{"display_login":"liuwenai"}}