Monday, June 3, 2024
 Popular · Latest · Hot · Upcoming
99
rated 0 times [  101] [ 2]  / answers: 1 / hits: 45538  / 11 Years ago, thu, october 31, 2013, 12:00:00

I was wondering what the 'this' value (or invocation context) is of the forEach callback function. This code doesn't seem to work:



var jow = [5, 10, 45, 67];

jow.forEach(function(v, i, a){

this[i] = v + 1;

});

alert(jow);


Thx for explaining it to me.


More From » function

 Answers
21

I finished construction of the forEach method and wanted to share this diagram with everyone, hope it helps someone else trying to understand its inner workings.



The


[#74585] Wednesday, October 30, 2013, 11 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
micayla

Total Points: 148
Total Questions: 92
Total Answers: 109

Location: Aruba
Member since Sat, Oct 2, 2021
3 Years ago
micayla questions
Fri, Dec 24, 21, 00:00, 3 Years ago
Thu, Apr 16, 20, 00:00, 4 Years ago
Thu, Nov 14, 19, 00:00, 5 Years ago
;