fix: Fix misleading lexical claim in setInterval docs to match the actual example#43465
fix: Fix misleading lexical claim in setInterval docs to match the actual example#43465
Conversation
|
The fix removes the incorrect claim, which makes the section accurate. Would it be better to either:
right now the explanation is correct but loses some educational value. |
@grayguava Thanks for considering my pr . I see your point. How about adding real example that demonstrates lexical |
This example works well and clearly demonstrates lexical That could make the explanation clearer for readers who are less familiar with how this works in callbacks. |
|
Thanks, I can't review this at this very moment, but like many MDN pages outside the JS area, anything involving JS mechanics is probably somewhat off😅 I will give the section a read and see if more changes are needed. |
@Josh-Cena Would it be okay if I update my PR based on this feedback? |
|
Please make any change that you see fit; I will reread the whole thing later. |
|
Preview URLs (1 page) |
Description
Updated the text in the "Functions are called with the global
this" section of thesetIntervalpage. Removed the incorrect claim about arrow functions using lexicalthis, since the example just wraps the method call with dot notation.Motivation
The old text said the example demonstrates lexical
this, but it doesn't - the arrow function simply callsmyArray.myMethod()directly, which works because of dot notation, not lexicalthis. This was confusing and technically incorrect.Related issues and pull requests
Fixes #43441