Open Bug 1347496 Opened 3 years ago

Inaccurate information in a code snippet

Categories

(Developer Documentation :: JavaScript, enhancement, P5)

All
Other
enhancement

Tracking

(Not tracked)

UNCONFIRMED

People

(Reporter: regspam, Unassigned)

References

()

Details

:: Developer Documentation Request

      Request Type: Correction
     Gecko Version: unspecified
 Technical Contact: 

:: Details

The code snippet in the "Custom Object" section, right before the "Inner functions" subsection is:

function lastNameCaps() {
  return this.last.toUpperCase();
}
var s = new Person('Simon', 'Willison');
lastNameCaps.call(s);
// Is the same as:
s.lastNameCaps = lastNameCaps;
s.lastNameCaps();

However "lastNameCaps.call(s)" is not quite the same as "s.lastNameCaps = lastNameCaps; s.lastNameCaps();", because in the former case "s" doesn't get the "lastNameCaps" property.
You need to log in before you can comment on or make changes to this bug.