javascript - Accessing object data with forEach, without the use of forEach's thisArg? -
I am studying and trying to get a better understanding of "this".
Although I have something that is confusing me: I may not have to use object data (in this case of "user" object) without the use of "this" argument of the unit
I can get information like this:
var user = {tournament: "owner", data: [{name: T. Woods ", age: 37}, {name:" p. Miklson ", Age: 43}], clickhandler: function () {this.data.forEach (function (person) {console.log};})}} User.clickHandler (); //" t. Woods "," p. However, "undefined" has been brought down: console.log (user.data .name);
or this "this. User is undefined "brings:
console.log (this.user.data.name);
What am I missing? Is not possible for "backgrac" and, for each, use access object information without the use of this agri? Or perhaps, what is written as long as "person"?
:
If the
thisArg
parameter for/ Code>, if applicable, callback It will be given, its value for its use otherwise, the value
undefined
will be passed for its use as its value.
It is not "Backgrac " thisArg
.
Comments
Post a Comment