Closed
Bug 1394123
Opened 8 years ago
Closed 5 years ago
Property Accessors: No mention of what happens when a property is not present on an object
Categories
(Developer Documentation Graveyard :: JavaScript, defect, P5)
Tracking
(Not tracked)
RESOLVED
WONTFIX
People
(Reporter: jason, Unassigned)
References
()
Details
:: Developer Documentation Request
Request Type: Correction
Gecko Version: Trunk
Technical Contact:
:: Details
Property Accessors documentation (Javascript ref, operators) explains the use of dot notation and bracket notation for accessing properties of an object, but does not explain what occurs when no such property exists on the object. Consider:
var myObj = {foo: 1}
What does `myObj.bar` return? What about `myObj['bar']`, any difference? I *think* both return `undefined` (not certain, that's why I'm checking the docs), but someone coming from another language could expect `null` to be returned, or even an exception to be thrown. Also, is there any mechanism available to intercept attempts to access such undefined properties, and act on them?
Comment 1•5 years ago
|
||
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: 5 years ago
Resolution: --- → WONTFIX
You need to log in
before you can comment on or make changes to this bug.
Description
•