{"action":"created","issue":{"url":"https://api.github.com/repos/workshopper/learnyounode/issues/446","repository_url":"https://api.github.com/repos/workshopper/learnyounode","labels_url":"https://api.github.com/repos/workshopper/learnyounode/issues/446/labels{/name}","comments_url":"https://api.github.com/repos/workshopper/learnyounode/issues/446/comments","events_url":"https://api.github.com/repos/workshopper/learnyounode/issues/446/events","html_url":"https://github.com/workshopper/learnyounode/issues/446","id":164395932,"number":446,"title":"Why does console.log work with no arguments for http_client \"best answer?\"","user":{"login":"caboosesw","id":8786708,"avatar_url":"https://avatars.githubusercontent.com/u/8786708?v=3","gravatar_id":"","url":"https://api.github.com/users/caboosesw","html_url":"https://github.com/caboosesw","followers_url":"https://api.github.com/users/caboosesw/followers","following_url":"https://api.github.com/users/caboosesw/following{/other_user}","gists_url":"https://api.github.com/users/caboosesw/gists{/gist_id}","starred_url":"https://api.github.com/users/caboosesw/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/caboosesw/subscriptions","organizations_url":"https://api.github.com/users/caboosesw/orgs","repos_url":"https://api.github.com/users/caboosesw/repos","events_url":"https://api.github.com/users/caboosesw/events{/privacy}","received_events_url":"https://api.github.com/users/caboosesw/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2016-07-07T20:08:55Z","updated_at":"2016-07-07T21:22:55Z","closed_at":null,"body":"```javascript\r\nres.on('data', console.log)\r\n```\r\n\r\nI can't intuitively figure this out or find any reference to why this would \"know\" to output something from a buffer.\r\n\r\nhttps://nodejs.org/api/console.html#console_console_log_data\r\n\r\nThoughts?\r\n\r\nI got my code working by explictly referencing the buffer like so ...\r\n\r\n```javascript\r\nres.on('data', function(chunk) {\r\n    console.log(chunk);\r\n});\r\n```"},"comment":{"url":"https://api.github.com/repos/workshopper/learnyounode/issues/comments/231211419","html_url":"https://github.com/workshopper/learnyounode/issues/446#issuecomment-231211419","issue_url":"https://api.github.com/repos/workshopper/learnyounode/issues/446","id":231211419,"user":{"login":"timoxley","id":43438,"avatar_url":"https://avatars.githubusercontent.com/u/43438?v=3","gravatar_id":"","url":"https://api.github.com/users/timoxley","html_url":"https://github.com/timoxley","followers_url":"https://api.github.com/users/timoxley/followers","following_url":"https://api.github.com/users/timoxley/following{/other_user}","gists_url":"https://api.github.com/users/timoxley/gists{/gist_id}","starred_url":"https://api.github.com/users/timoxley/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/timoxley/subscriptions","organizations_url":"https://api.github.com/users/timoxley/orgs","repos_url":"https://api.github.com/users/timoxley/repos","events_url":"https://api.github.com/users/timoxley/events{/privacy}","received_events_url":"https://api.github.com/users/timoxley/received_events","type":"User","site_admin":false},"created_at":"2016-07-07T21:22:55Z","updated_at":"2016-07-07T21:22:55Z","body":"* JavaScript has first class functions, meaning they can be passed around just like any other value. \r\n* In both cases you're passing a function as the second argument to the `on` function. \r\n* `console.log` is a function value, as is `function(){}`. \r\n* `function () { ... }` is not really special syntax. It simply creates a function value.\r\n* The function value you're passing just happens to call console.log in its body.\r\n* When the 'data' event is fired, the second argument to `on` is called. It's called with the data as the first argument. \r\n* So when the data event occurs in `on('data', console.log)`, the second argument, which happens to be the `console.log` function, is called with data as the first argument.\r\n\r\n"}}
{"actor":{"display_login":"timoxley"}}