{"action":"opened","issue":{"url":"https://api.github.com/repos/AlbertoMontalesi/The-complete-guide-to-modern-JavaScript-from-es2015-to-es2018/issues/9","repository_url":"https://api.github.com/repos/AlbertoMontalesi/The-complete-guide-to-modern-JavaScript-from-es2015-to-es2018","labels_url":"https://api.github.com/repos/AlbertoMontalesi/The-complete-guide-to-modern-JavaScript-from-es2015-to-es2018/issues/9/labels{/name}","comments_url":"https://api.github.com/repos/AlbertoMontalesi/The-complete-guide-to-modern-JavaScript-from-es2015-to-es2018/issues/9/comments","events_url":"https://api.github.com/repos/AlbertoMontalesi/The-complete-guide-to-modern-JavaScript-from-es2015-to-es2018/issues/9/events","html_url":"https://github.com/AlbertoMontalesi/The-complete-guide-to-modern-JavaScript-from-es2015-to-es2018/issues/9","id":331339869,"node_id":"MDU6SXNzdWUzMzEzMzk4Njk=","number":9,"title":"Chapter 3: Default function arguments","user":{"login":"isafrus5","id":6947082,"node_id":"MDQ6VXNlcjY5NDcwODI=","avatar_url":"https://avatars2.githubusercontent.com/u/6947082?v=4","gravatar_id":"","url":"https://api.github.com/users/isafrus5","html_url":"https://github.com/isafrus5","followers_url":"https://api.github.com/users/isafrus5/followers","following_url":"https://api.github.com/users/isafrus5/following{/other_user}","gists_url":"https://api.github.com/users/isafrus5/gists{/gist_id}","starred_url":"https://api.github.com/users/isafrus5/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/isafrus5/subscriptions","organizations_url":"https://api.github.com/users/isafrus5/orgs","repos_url":"https://api.github.com/users/isafrus5/repos","events_url":"https://api.github.com/users/isafrus5/events{/privacy}","received_events_url":"https://api.github.com/users/isafrus5/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-06-11T20:34:51Z","updated_at":"2018-06-11T20:34:51Z","closed_at":null,"author_association":"NONE","body":"Hi Alberto!\r\n\r\nI think that something you can add to this chapter as a warning or whatever you want to calle it, is that default parameters are only applied if the arguments is undefined.\r\n\r\nTry this:\r\n\r\n```javascript\r\nconst printText = (text = 'default') => console.log(text)\r\n\r\nprintText('Alberto')\r\n// prints ---> 'Alberto'\r\n\r\nprintText(undefined)\r\n// prints ---> 'default'\r\n\r\nprintText(false)\r\n// prints ---> false\r\n\r\nprintText(null)\r\n// prints ---> null\r\n\r\nprintText('')\r\n// prints ---> ''\r\n```\r\n\r\nSo an alternative to this could be use the ``` || ``` operator. "}}
{"actor":{"display_login":"isafrus5"}}