fix/Clarification for code example

Clarification needed for Functional Programming code example, in the challenge Add Elements to the End of an Array Using concat Instead of push
pull/18182/head
tommy 2017-06-26 16:28:24 -07:00 committed by GitHub
parent 6d18ebdc70
commit e1f6eea881
1 changed files with 1 additions and 1 deletions

View File

@ -831,7 +831,7 @@
"description": [ "description": [
"Functional programming is all about creating and using non-mutating functions.", "Functional programming is all about creating and using non-mutating functions.",
"The last challenge introduced the <code>concat</code> method as a way to combine arrays into a new one without mutating the original arrays. Compare <code>concat</code> to the <code>push</code> method. <code>Push</code> adds an item to the end of the same array it is called on, which mutates that array. Here's an example:", "The last challenge introduced the <code>concat</code> method as a way to combine arrays into a new one without mutating the original arrays. Compare <code>concat</code> to the <code>push</code> method. <code>Push</code> adds an item to the end of the same array it is called on, which mutates that array. Here's an example:",
"<blockquote>var arr = [1, 2, 3];<br>arr.push([4, 5, 6]);<br>// arr is changed to [1, 2, 3, 4, 5, 6]<br>// Not the functional programming way</blockquote>", "<blockquote>var arr = [1, 2, 3];<br>arr.push([4, 5, 6]);<br>// arr is changed to [1, 2, 3, [4, 5, 6]]<br>// Not the functional programming way</blockquote>",
"<code>Concat</code> offers a way to add new items to the end of an array without any mutating side effects.", "<code>Concat</code> offers a way to add new items to the end of an array without any mutating side effects.",
"<hr>", "<hr>",
"Change the <code>nonMutatingPush</code> function so it uses <code>concat</code> to add <code>newItem</code> to the end of <code>original</code> instead of <code>push</code>. The function should return an array." "Change the <code>nonMutatingPush</code> function so it uses <code>concat</code> to add <code>newItem</code> to the end of <code>original</code> instead of <code>push</code>. The function should return an array."