{"action":"created","comment":{"url":"https://api.github.com/repos/Microsoft/TypeScript-Handbook/pulls/comments/45267245","id":45267245,"diff_hunk":"@@ -127,44 +127,64 @@ function buildName(firstName: string, lastName?: string) {\n         return firstName;\n }\n \n-var result1 = buildName(\"Bob\");  // works correctly now\n+var result1 = buildName(\"Bob\");                  // works correctly now\n var result2 = buildName(\"Bob\", \"Adams\", \"Sr.\");  // error, too many parameters\n-var result3 = buildName(\"Bob\", \"Adams\");  // ah, just right\n+var result3 = buildName(\"Bob\", \"Adams\");         // ah, just right\n ```\n \n-Optional parameters must follow required parameters.\n+Any optional parameters must follow required parameters.\n Had we wanted to make the first name optional rather than the last name, we would need to change the order of parameters in the function, putting the first name last in the list.\n \n-In TypeScript, we can also set up a value that an optional parameter will have if the user does not provide one.\n-These are called default parameters. Let's take the previous example and default the last name to `\"Smith\"`.\n+In TypeScript, we can also set up a value that parameter will have if the user does not provide one, or if the user passes `undefined` in its place.\n+These are called default-initialized parameters.\n+Let's take the previous example and default the last name to `\"Smith\"`.\n \n ```ts\n function buildName(firstName: string, lastName = \"Smith\") {\n     return firstName + \" \" + lastName;\n }\n \n-var result1 = buildName(\"Bob\");  // works correctly now, also\n-var result2 = buildName(\"Bob\", \"Adams\", \"Sr.\");  // error, too many parameters\n-var result3 = buildName(\"Bob\", \"Adams\");  // ah, just right\n+var result1 = buildName(\"Bob\");                  // works correctly now, returns \"Bob Smith\"\n+var result2 = buildName(\"Bob\", undefined);       // still works, also returns \"Bob Smith\"\n+var result3 = buildName(\"Bob\", \"Adams\", \"Sr.\");  // error, too many parameters\n+var result4 = buildName(\"Bob\", \"Adams\");         // ah, just right\n ```\n \n-Just as with optional parameters, default parameters must come after required parameters in the parameter list.\n-\n-Optional parameters and default parameters also share what the type looks like. Both:\n+Default-initialized parameters that come after all required parameters are treated as optional, and just like optional parameters, can be omitted when calling their respective function.","path":"pages/Functions.md","position":127,"original_position":127,"commit_id":"2a93302dfada27f3578d76332bf4969681bef994","original_commit_id":"2a93302dfada27f3578d76332bf4969681bef994","user":{"login":"sandersn","id":293473,"avatar_url":"https://avatars.githubusercontent.com/u/293473?v=3","gravatar_id":"","url":"https://api.github.com/users/sandersn","html_url":"https://github.com/sandersn","followers_url":"https://api.github.com/users/sandersn/followers","following_url":"https://api.github.com/users/sandersn/following{/other_user}","gists_url":"https://api.github.com/users/sandersn/gists{/gist_id}","starred_url":"https://api.github.com/users/sandersn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sandersn/subscriptions","organizations_url":"https://api.github.com/users/sandersn/orgs","repos_url":"https://api.github.com/users/sandersn/repos","events_url":"https://api.github.com/users/sandersn/events{/privacy}","received_events_url":"https://api.github.com/users/sandersn/received_events","type":"User","site_admin":false},"body":"Never mind, I read it in the new paragraph. I think most people will have the same question when reading, so maybe the new paragraph can be integrated better into the existing text than just sticking it on the end.","created_at":"2015-11-18T22:01:14Z","updated_at":"2015-11-18T22:01:14Z","html_url":"https://github.com/Microsoft/TypeScript-Handbook/pull/99#discussion_r45267245","pull_request_url":"https://api.github.com/repos/Microsoft/TypeScript-Handbook/pulls/99","_links":{"self":{"href":"https://api.github.com/repos/Microsoft/TypeScript-Handbook/pulls/comments/45267245"},"html":{"href":"https://github.com/Microsoft/TypeScript-Handbook/pull/99#discussion_r45267245"},"pull_request":{"href":"https://api.github.com/repos/Microsoft/TypeScript-Handbook/pulls/99"}}},"pull_request":{"url":"https://api.github.com/repos/Microsoft/TypeScript-Handbook/pulls/99","id":51142872,"html_url":"https://github.com/Microsoft/TypeScript-Handbook/pull/99","diff_url":"https://github.com/Microsoft/TypeScript-Handbook/pull/99.diff","patch_url":"https://github.com/Microsoft/TypeScript-Handbook/pull/99.patch","issue_url":"https://api.github.com/repos/Microsoft/TypeScript-Handbook/issues/99","number":99,"state":"open","locked":false,"title":"Updated content in 'Functions.md'","user":{"login":"DanielRosenwasser","id":972891,"avatar_url":"https://avatars.githubusercontent.com/u/972891?v=3","gravatar_id":"","url":"https://api.github.com/users/DanielRosenwasser","html_url":"https://github.com/DanielRosenwasser","followers_url":"https://api.github.com/users/DanielRosenwasser/followers","following_url":"https://api.github.com/users/DanielRosenwasser/following{/other_user}","gists_url":"https://api.github.com/users/DanielRosenwasser/gists{/gist_id}","starred_url":"https://api.github.com/users/DanielRosenwasser/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DanielRosenwasser/subscriptions","organizations_url":"https://api.github.com/users/DanielRosenwasser/orgs","repos_url":"https://api.github.com/users/DanielRosenwasser/repos","events_url":"https://api.github.com/users/DanielRosenwasser/events{/privacy}","received_events_url":"https://api.github.com/users/DanielRosenwasser/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-11-18T21:12:36Z","updated_at":"2015-11-18T22:01:14Z","closed_at":null,"merged_at":null,"merge_commit_sha":"ddf82e38d9730749df8db0138249c8181c46ce1b","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/Microsoft/TypeScript-Handbook/pulls/99/commits","review_comments_url":"https://api.github.com/repos/Microsoft/TypeScript-Handbook/pulls/99/comments","review_comment_url":"https://api.github.com/repos/Microsoft/TypeScript-Handbook/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Microsoft/TypeScript-Handbook/issues/99/comments","statuses_url":"https://api.github.com/repos/Microsoft/TypeScript-Handbook/statuses/2a93302dfada27f3578d76332bf4969681bef994","head":{"label":"Microsoft:updateFunctions","ref":"updateFunctions","sha":"2a93302dfada27f3578d76332bf4969681bef994","user":{"login":"Microsoft","id":6154722,"avatar_url":"https://avatars.githubusercontent.com/u/6154722?v=3","gravatar_id":"","url":"https://api.github.com/users/Microsoft","html_url":"https://github.com/Microsoft","followers_url":"https://api.github.com/users/Microsoft/followers","following_url":"https://api.github.com/users/Microsoft/following{/other_user}","gists_url":"https://api.github.com/users/Microsoft/gists{/gist_id}","starred_url":"https://api.github.com/users/Microsoft/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Microsoft/subscriptions","organizations_url":"https://api.github.com/users/Microsoft/orgs","repos_url":"https://api.github.com/users/Microsoft/repos","events_url":"https://api.github.com/users/Microsoft/events{/privacy}","received_events_url":"https://api.github.com/users/Microsoft/received_events","type":"Organization","site_admin":false},"repo":{"id":33742985,"name":"TypeScript-Handbook","full_name":"Microsoft/TypeScript-Handbook","owner":{"login":"Microsoft","id":6154722,"avatar_url":"https://avatars.githubusercontent.com/u/6154722?v=3","gravatar_id":"","url":"https://api.github.com/users/Microsoft","html_url":"https://github.com/Microsoft","followers_url":"https://api.github.com/users/Microsoft/followers","following_url":"https://api.github.com/users/Microsoft/following{/other_user}","gists_url":"https://api.github.com/users/Microsoft/gists{/gist_id}","starred_url":"https://api.github.com/users/Microsoft/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Microsoft/subscriptions","organizations_url":"https://api.github.com/users/Microsoft/orgs","repos_url":"https://api.github.com/users/Microsoft/repos","events_url":"https://api.github.com/users/Microsoft/events{/privacy}","received_events_url":"https://api.github.com/users/Microsoft/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Microsoft/TypeScript-Handbook","description":"The TypeScript Handbook is a comprehensive guide to the TypeScript language","fork":false,"url":"https://api.github.com/repos/Microsoft/TypeScript-Handbook","forks_url":"https://api.github.com/repos/Microsoft/TypeScript-Handbook/forks","keys_url":"https://api.github.com/repos/Microsoft/TypeScript-Handbook/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Microsoft/TypeScript-Handbook/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Microsoft/TypeScript-Handbook/teams","hooks_url":"https://api.github.com/repos/Microsoft/TypeScript-Handbook/hooks","issue_events_url":"https://api.github.com/repos/Microsoft/TypeScript-Handbook/issues/events{/number}","events_url":"https://api.github.com/repos/Microsoft/TypeScript-Handbook/events","assignees_url":"https://api.github.com/repos/Microsoft/TypeScript-Handbook/assignees{/user}","branches_url":"https://api.github.com/repos/Microsoft/TypeScript-Handbook/branches{/branch}","tags_url":"https://api.github.com/repos/Microsoft/TypeScript-Handbook/tags","blobs_url":"https://api.github.com/repos/Microsoft/TypeScript-Handbook/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Microsoft/TypeScript-Handbook/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Microsoft/TypeScript-Handbook/git/refs{/sha}","trees_url":"https://api.github.com/repos/Microsoft/TypeScript-Handbook/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Microsoft/TypeScript-Handbook/statuses/{sha}","languages_url":"https://api.github.com/repos/Microsoft/TypeScript-Handbook/languages","stargazers_url":"https://api.github.com/repos/Microsoft/TypeScript-Handbook/stargazers","contributors_url":"https://api.github.com/repos/Microsoft/TypeScript-Handbook/contributors","subscribers_url":"https://api.github.com/repos/Microsoft/TypeScript-Handbook/subscribers","subscription_url":"https://api.github.com/repos/Microsoft/TypeScript-Handbook/subscription","commits_url":"https://api.github.com/repos/Microsoft/TypeScript-Handbook/commits{/sha}","git_commits_url":"https://api.github.com/repos/Microsoft/TypeScript-Handbook/git/commits{/sha}","comments_url":"https://api.github.com/repos/Microsoft/TypeScript-Handbook/comments{/number}","issue_comment_url":"https://api.github.com/repos/Microsoft/TypeScript-Handbook/issues/comments{/number}","contents_url":"https://api.github.com/repos/Microsoft/TypeScript-Handbook/contents/{+path}","compare_url":"https://api.github.com/repos/Microsoft/TypeScript-Handbook/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Microsoft/TypeScript-Handbook/merges","archive_url":"https://api.github.com/repos/Microsoft/TypeScript-Handbook/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Microsoft/TypeScript-Handbook/downloads","issues_url":"https://api.github.com/repos/Microsoft/TypeScript-Handbook/issues{/number}","pulls_url":"https://api.github.com/repos/Microsoft/TypeScript-Handbook/pulls{/number}","milestones_url":"https://api.github.com/repos/Microsoft/TypeScript-Handbook/milestones{/number}","notifications_url":"https://api.github.com/repos/Microsoft/TypeScript-Handbook/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Microsoft/TypeScript-Handbook/labels{/name}","releases_url":"https://api.github.com/repos/Microsoft/TypeScript-Handbook/releases{/id}","created_at":"2015-04-10T18:03:58Z","updated_at":"2015-11-18T16:00:21Z","pushed_at":"2015-11-18T21:12:36Z","git_url":"git://github.com/Microsoft/TypeScript-Handbook.git","ssh_url":"git@github.com:Microsoft/TypeScript-Handbook.git","clone_url":"https://github.com/Microsoft/TypeScript-Handbook.git","svn_url":"https://github.com/Microsoft/TypeScript-Handbook","homepage":null,"size":281,"stargazers_count":121,"watchers_count":121,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":49,"mirror_url":null,"open_issues_count":41,"forks":49,"open_issues":41,"watchers":121,"default_branch":"master"}},"base":{"label":"Microsoft:master","ref":"master","sha":"c6e2b7319e598d9648e690765365123a5c932a1c","user":{"login":"Microsoft","id":6154722,"avatar_url":"https://avatars.githubusercontent.com/u/6154722?v=3","gravatar_id":"","url":"https://api.github.com/users/Microsoft","html_url":"https://github.com/Microsoft","followers_url":"https://api.github.com/users/Microsoft/followers","following_url":"https://api.github.com/users/Microsoft/following{/other_user}","gists_url":"https://api.github.com/users/Microsoft/gists{/gist_id}","starred_url":"https://api.github.com/users/Microsoft/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Microsoft/subscriptions","organizations_url":"https://api.github.com/users/Microsoft/orgs","repos_url":"https://api.github.com/users/Microsoft/repos","events_url":"https://api.github.com/users/Microsoft/events{/privacy}","received_events_url":"https://api.github.com/users/Microsoft/received_events","type":"Organization","site_admin":false},"repo":{"id":33742985,"name":"TypeScript-Handbook","full_name":"Microsoft/TypeScript-Handbook","owner":{"login":"Microsoft","id":6154722,"avatar_url":"https://avatars.githubusercontent.com/u/6154722?v=3","gravatar_id":"","url":"https://api.github.com/users/Microsoft","html_url":"https://github.com/Microsoft","followers_url":"https://api.github.com/users/Microsoft/followers","following_url":"https://api.github.com/users/Microsoft/following{/other_user}","gists_url":"https://api.github.com/users/Microsoft/gists{/gist_id}","starred_url":"https://api.github.com/users/Microsoft/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Microsoft/subscriptions","organizations_url":"https://api.github.com/users/Microsoft/orgs","repos_url":"https://api.github.com/users/Microsoft/repos","events_url":"https://api.github.com/users/Microsoft/events{/privacy}","received_events_url":"https://api.github.com/users/Microsoft/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Microsoft/TypeScript-Handbook","description":"The TypeScript Handbook is a comprehensive guide to the TypeScript language","fork":false,"url":"https://api.github.com/repos/Microsoft/TypeScript-Handbook","forks_url":"https://api.github.com/repos/Microsoft/TypeScript-Handbook/forks","keys_url":"https://api.github.com/repos/Microsoft/TypeScript-Handbook/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Microsoft/TypeScript-Handbook/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Microsoft/TypeScript-Handbook/teams","hooks_url":"https://api.github.com/repos/Microsoft/TypeScript-Handbook/hooks","issue_events_url":"https://api.github.com/repos/Microsoft/TypeScript-Handbook/issues/events{/number}","events_url":"https://api.github.com/repos/Microsoft/TypeScript-Handbook/events","assignees_url":"https://api.github.com/repos/Microsoft/TypeScript-Handbook/assignees{/user}","branches_url":"https://api.github.com/repos/Microsoft/TypeScript-Handbook/branches{/branch}","tags_url":"https://api.github.com/repos/Microsoft/TypeScript-Handbook/tags","blobs_url":"https://api.github.com/repos/Microsoft/TypeScript-Handbook/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Microsoft/TypeScript-Handbook/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Microsoft/TypeScript-Handbook/git/refs{/sha}","trees_url":"https://api.github.com/repos/Microsoft/TypeScript-Handbook/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Microsoft/TypeScript-Handbook/statuses/{sha}","languages_url":"https://api.github.com/repos/Microsoft/TypeScript-Handbook/languages","stargazers_url":"https://api.github.com/repos/Microsoft/TypeScript-Handbook/stargazers","contributors_url":"https://api.github.com/repos/Microsoft/TypeScript-Handbook/contributors","subscribers_url":"https://api.github.com/repos/Microsoft/TypeScript-Handbook/subscribers","subscription_url":"https://api.github.com/repos/Microsoft/TypeScript-Handbook/subscription","commits_url":"https://api.github.com/repos/Microsoft/TypeScript-Handbook/commits{/sha}","git_commits_url":"https://api.github.com/repos/Microsoft/TypeScript-Handbook/git/commits{/sha}","comments_url":"https://api.github.com/repos/Microsoft/TypeScript-Handbook/comments{/number}","issue_comment_url":"https://api.github.com/repos/Microsoft/TypeScript-Handbook/issues/comments{/number}","contents_url":"https://api.github.com/repos/Microsoft/TypeScript-Handbook/contents/{+path}","compare_url":"https://api.github.com/repos/Microsoft/TypeScript-Handbook/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Microsoft/TypeScript-Handbook/merges","archive_url":"https://api.github.com/repos/Microsoft/TypeScript-Handbook/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Microsoft/TypeScript-Handbook/downloads","issues_url":"https://api.github.com/repos/Microsoft/TypeScript-Handbook/issues{/number}","pulls_url":"https://api.github.com/repos/Microsoft/TypeScript-Handbook/pulls{/number}","milestones_url":"https://api.github.com/repos/Microsoft/TypeScript-Handbook/milestones{/number}","notifications_url":"https://api.github.com/repos/Microsoft/TypeScript-Handbook/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Microsoft/TypeScript-Handbook/labels{/name}","releases_url":"https://api.github.com/repos/Microsoft/TypeScript-Handbook/releases{/id}","created_at":"2015-04-10T18:03:58Z","updated_at":"2015-11-18T16:00:21Z","pushed_at":"2015-11-18T21:12:36Z","git_url":"git://github.com/Microsoft/TypeScript-Handbook.git","ssh_url":"git@github.com:Microsoft/TypeScript-Handbook.git","clone_url":"https://github.com/Microsoft/TypeScript-Handbook.git","svn_url":"https://github.com/Microsoft/TypeScript-Handbook","homepage":null,"size":281,"stargazers_count":121,"watchers_count":121,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":49,"mirror_url":null,"open_issues_count":41,"forks":49,"open_issues":41,"watchers":121,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/Microsoft/TypeScript-Handbook/pulls/99"},"html":{"href":"https://github.com/Microsoft/TypeScript-Handbook/pull/99"},"issue":{"href":"https://api.github.com/repos/Microsoft/TypeScript-Handbook/issues/99"},"comments":{"href":"https://api.github.com/repos/Microsoft/TypeScript-Handbook/issues/99/comments"},"review_comments":{"href":"https://api.github.com/repos/Microsoft/TypeScript-Handbook/pulls/99/comments"},"review_comment":{"href":"https://api.github.com/repos/Microsoft/TypeScript-Handbook/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Microsoft/TypeScript-Handbook/pulls/99/commits"},"statuses":{"href":"https://api.github.com/repos/Microsoft/TypeScript-Handbook/statuses/2a93302dfada27f3578d76332bf4969681bef994"}}}}