-
-
Notifications
You must be signed in to change notification settings - Fork 3
newListOfObjectFunctions
Wesley de Groot edited this page Nov 19, 2015
·
2 revisions
Weird page name.
var x = {}
x.y = function (d) { console.log(d) }
x.x = 'ok'
And/Or
var y = {
y: function (d) { console.log(d) },
x: 'ok'
}
> x.y('hi')
[Log] hi
undefined // Because of no return value
> x.x
"ok" = $1
And
> y.y('hi')
[Log] hi
undefined // Because of no return value
> y.x
"ok" = $1
var xr = {}
xr.y = function (d) { console.log(d); return d }
xr.x = 'ok'
And/Or
var xy = {
y: function (d) { console.log(d); return d },
x: 'ok'
}
> xr.y('d')
[Log] d
< "d" = $3
> xr.x
"ok" = $1
And
> xy.y('d')
[Log] d
< "d" = $3
> xy.x
"ok" = $1
...
© Wesley de Groot • CC-BY 4.0 • WDGWV