Created
March 23, 2019 09:31
-
-
Save buglessir/a4e2c2080cf08f262517b62596e103f5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function mutation(originalArray) { | |
// directly mutating/modifying the original array | |
originalArray[0] = "new value"; | |
return originalArray; | |
} | |
var array = ["some value", "another value"]; | |
alert("Return from mutation " + mutation(array)); | |
alert("Array: " + array + " (original array has been altered)."); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment