{"action":"created","issue":{"url":"https://api.github.com/repos/N-ZOO/everycode/issues/12","labels_url":"https://api.github.com/repos/N-ZOO/everycode/issues/12/labels{/name}","comments_url":"https://api.github.com/repos/N-ZOO/everycode/issues/12/comments","events_url":"https://api.github.com/repos/N-ZOO/everycode/issues/12/events","html_url":"https://github.com/N-ZOO/everycode/issues/12","id":123929207,"number":12,"title":"[js] ip地址解析","user":{"login":"VaJoy","id":7721635,"avatar_url":"https://avatars.githubusercontent.com/u/7721635?v=3","gravatar_id":"","url":"https://api.github.com/users/VaJoy","html_url":"https://github.com/VaJoy","followers_url":"https://api.github.com/users/VaJoy/followers","following_url":"https://api.github.com/users/VaJoy/following{/other_user}","gists_url":"https://api.github.com/users/VaJoy/gists{/gist_id}","starred_url":"https://api.github.com/users/VaJoy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/VaJoy/subscriptions","organizations_url":"https://api.github.com/users/VaJoy/orgs","repos_url":"https://api.github.com/users/VaJoy/repos","events_url":"https://api.github.com/users/VaJoy/events{/privacy}","received_events_url":"https://api.github.com/users/VaJoy/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/N-ZOO/everycode/labels/js","name":"js","color":"c7def8"},{"url":"https://api.github.com/repos/N-ZOO/everycode/labels/%E9%9A%BE%E5%BA%A6%E2%98%85%E2%98%85%E2%98%85%E2%98%85","name":"难度★★★★","color":"e11d21"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-12-26T13:18:37Z","updated_at":"2015-12-27T15:12:56Z","closed_at":null,"body":"```js\r\n//把已知的ip二进制数值联合起来的十进制值，反解码为IP形式\r\n// 如 2149583361 > 10000000 00100000 00001010 00000001 > \"128.32.10.1\"\r\nfunction decodeIp(int32) {\r\n  //TODO: 返回对应的ip地址\r\n}\r\nconsole.log(decodeIp(2149583361));  //\"128.32.10.1\"\r\n```"},"comment":{"url":"https://api.github.com/repos/N-ZOO/everycode/issues/comments/167419594","html_url":"https://github.com/N-ZOO/everycode/issues/12#issuecomment-167419594","issue_url":"https://api.github.com/repos/N-ZOO/everycode/issues/12","id":167419594,"user":{"login":"langmao","id":16217908,"avatar_url":"https://avatars.githubusercontent.com/u/16217908?v=3","gravatar_id":"","url":"https://api.github.com/users/langmao","html_url":"https://github.com/langmao","followers_url":"https://api.github.com/users/langmao/followers","following_url":"https://api.github.com/users/langmao/following{/other_user}","gists_url":"https://api.github.com/users/langmao/gists{/gist_id}","starred_url":"https://api.github.com/users/langmao/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/langmao/subscriptions","organizations_url":"https://api.github.com/users/langmao/orgs","repos_url":"https://api.github.com/users/langmao/repos","events_url":"https://api.github.com/users/langmao/events{/privacy}","received_events_url":"https://api.github.com/users/langmao/received_events","type":"User","site_admin":false},"created_at":"2015-12-27T15:12:56Z","updated_at":"2015-12-27T15:12:56Z","body":"```js\r\n//本题其实就是考二进制，十进制之间的转换，贴一个没有容错处理的吧\r\n   function decodeIp(int32) {\r\n\t  \r\n\t  var byt = int32.toString(2), //2进制表示\r\n\t      reg = /(?:[0-1]{8})/g, // 每八位一组\r\n\t      bytegroup = byt.match(reg);\r\n\r\n          //TODO 后期看看能有什么优化\r\n\t\t  return bytegroup.map(function(num){\r\n\t\t      return parseInt(num,2);//转换为十进制\r\n\t\t  });\r\n\r\n  }\r\n```"}}