Alter properties of objects in a function (Javascript) -
Alter properties of objects in a function (Javascript) -
i have declared variable in main html page such:
var colorbuffer; i pass variable function:
myfunc("example.txt", colorbuffer); within function property of variable set shown:
function myfunc(file, colbuf) { ... colbuf.items = 4; } however when refer 'colorbuffer.items' within main html page error 'cannot read property 'items' of undefined'.
so seems using parameter name colbuf not impact argument colorbuffer passed in...how set items property of colorbuffer within function?
many thanks.
setting colorbuffer object resolve this.
var colorbuffer = {}; javascript function parameters
Comments
Post a Comment