Skip to content

Commit 3c6245b

Browse files
authored
Merge pull request #473 from skube/patch-3
Fix rest parameter mis-match
2 parents a22c2a3 + b8d1e69 commit 3c6245b

File tree

1 file changed

+5
-4
lines changed
  • 1-js/06-advanced-functions/02-rest-parameters-spread-operator

1 file changed

+5
-4
lines changed

1-js/06-advanced-functions/02-rest-parameters-spread-operator/article.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,11 @@ Here the first two arguments go into variables and the rest goes to `titles` arr
5353
function showName(firstName, lastName, ...titles) {
5454
alert( firstName + ' ' + lastName ); // Julius Caesar
5555

56-
// the rest = ["Consul", "Imperator"]
57-
alert( rest[0] ); // Consul
58-
alert( rest[1] ); // Imperator
59-
alert( rest.length ); // 2
56+
// the rest go into titles array
57+
// i.e. titles = ["Consul", "Imperator"]
58+
alert( titles[0] ); // Consul
59+
alert( titles[1] ); // Imperator
60+
alert( titles.length ); // 2
6061
}
6162

6263
showName("Julius", "Caesar", "Consul", "Imperator");

0 commit comments

Comments
 (0)