Skip to content

Instantly share code, notes, and snippets.

@simondell
Created November 13, 2013 10:35
Show Gist options
  • Save simondell/7446952 to your computer and use it in GitHub Desktop.
Save simondell/7446952 to your computer and use it in GitHub Desktop.
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