re: Keeping Your Code Simple VIEW POST

TOP OF THREAD FULL DISCUSSION
re: it's accessible because of scope. a variable declared inside the reduce wouldn't be accessable outside its scope; however, the other way around is ...
 

No. What i am saying is let lenX = str1.length will produce a null reference exception because str1 is not available outside the reducer.

imho the external assignment cannot however work ... i think that it isn't evaluated at each cycle of reduce ... or am I wrong ?

code of conduct - report abuse