Skip to content

Instantly share code, notes, and snippets.

@Williammer
Last active August 29, 2015 14:02
Show Gist options
  • Select an option

  • Save Williammer/eb9f264dfc33ba58dc4b to your computer and use it in GitHub Desktop.

Select an option

Save Williammer/eb9f264dfc33ba58dc4b to your computer and use it in GitHub Desktop.
javaScript.ReferenceTypesExamples.js - The most obvious features of the three reference types.
//Reference Types Examples
var ref_fn = function () {
return true;
}
, ref_obj = {
name: 'obj'
}
, ref_arr = ['arr', 2, {
"p": 3
}]
var aa = ref_fn;
ref_fn.prp = 'xxref_fn';
alert('ref_fn: ' + aa.prp);
var aa = ref_obj;
ref_obj.prp = 'xxref_obj';
alert('ref_obj: ' + aa.prp);
var aa = ref_arr;
ref_arr.prp = 'xxref_arr';
alert('ref_arr: ' + aa.prp);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment