Closed Bug 1243917 Opened 8 years ago Closed 8 years ago

Remove named function syntax for methods

Categories

(Developer Documentation Graveyard :: JavaScript, defect, P5)

All
Other
defect

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: ajkerrigan, Assigned: ajkerrigan)

References

()

Details

:: Developer Documentation Request

      Request Type: Correction
     Gecko Version: unspecified
 Technical Contact: 

:: Details

The XUL Tips section on this page includes the following code example:

var UniqueName = {
  _privateMember: 3,
  publicMember: "A string",

  init: function UN_init() {
    this.doSomething(this.anotherMember);
  },

  doSomething: function UN_doSomething(aParam) {
    alert(aParam);
  }
};

That style conflicts the main MDN Coding Style page, which says: "In JavaScript, functions should use camelCase but should not capitalize the first letter. Methods should not use the named function expression syntax, because our tools understand method names."

It sounds like debugging tools advanced and the main style page got updated, while this one was left with an older style. Remove the named functions from methods on this page.

For reference: https://developer.mozilla.org/en-US/docs/Mozilla/Developer_guide/Coding_Style#JavaScript_practices
This is the doc change that came from our discussion about Bug 1243764. Mind assigning me when you get a chance?
Flags: needinfo?(lclark)
Assignee: nobody → ajkerrigan
Flags: needinfo?(lclark)
Status: UNCONFIRMED → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.