Created
November 13, 2013 10:35
-
-
Save simondell/7446952 to your computer and use it in GitHub Desktop.
A counter-example to Cody Lindley's "part 7". http://tech.pro/tutorial/1669/21-javascript-parts-i-struggle-to-remember-
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
var arg_ary = [ 1, 2, 3 ]; | |
var arg_obj = { foo: 'bar' }; | |
function reset( param ) { | |
param[0] = undefined; | |
console.log( "in reset", param ); | |
} | |
console.log( arg_ary ); // [ 1, 2, 3 ] | |
reset( arg_ary ); // [ undefined, 2, 3 ] | |
console.log( arg_ary ); // [ undefined, 2, 3 ] | |
console.log( arg_obj ); // { foo: 'bar' } | |
reset( arg_obj ); // { 0: undefined, foo: 'bar' } | |
console.log( arg_obj ); // { 0: undefined, foo: 'bar' } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment