The only way you can really use aliases in javascript is to use objects.
Objects are available in js, for example pointers:
Example:
var myobj = {hello: "world"}; var myalias = myobj; myobj.hello = "goodbye"; console.log(myobj.hello); => // "goodbye" console.log(myalias.hello); => // "goodbye"
You cannot create an alias for string, number, boolean, etc.
Example:
var myint = 1; var myalias = myint; myint = 2; console.log(myint); =>
PD: all types (e.g. Array or RegExp) except Int, String, Boolean, null and undefined are treated as objects.
source share