Closed Bug 1408621 Opened 7 years ago Closed 4 years ago

Re-Introduction to JavaScript - Functions: confusing use of fullName();

Categories

(Developer Documentation Graveyard :: JavaScript, enhancement, P3)

All
Other
enhancement

Tracking

(Not tracked)

RESOLVED WONTFIX

People

(Reporter: darren_adkinson, Unassigned)

References

()

Details

:: Developer Documentation Request

      Request Type: Correction
     Gecko Version: unspecified
 Technical Contact: 

:: Details

The section begins with this sentence (my emphasis added for keyword "this"): "Note that *this* is a frequent cause of mistakes."

Then the example given in line three calls the function fullName(); and suggests that the output would be "undefined undefined". AFAICT if fullName() is called you'll get a type error as it's not a method of the global object. The sentence beneath the three line example talks about "this" being bound to the global object, however we don't get that far since the method isn't even reachable. From what I can tell you would get the suggested output only by calling the method like this:

s.fullName.apply(Window); // undefined undefined

but putting this in the text would lead to a very confusing and contrived example in order to show how people are often confused by "this".

I suggest removing or re-writing the example or include a small section on various different ways "this" is used.
Priority: P5 → P3
Hiya,

I am currently looking for bugs to fix as part of my Open Source Development module at Coventry University and I am interested in developing this bug.

Please could you assign this task to me and give me more information.

This is my first bug fix and any help would be appreciated.

Thank you.
MDN Web Docs' bug reporting has now moved to GitHub. From now on, please file content bugs at https://github.com/mdn/sprints/issues/ and platform bugs at https://github.com/mdn/kuma/issues/.
Status: UNCONFIRMED → RESOLVED
Closed: 4 years ago
Resolution: --- → WONTFIX
You need to log in before you can comment on or make changes to this bug.