Closed Bug 1412101 Opened 7 years ago Closed 4 years ago

Discussion of "boolean operator" should be clarified or deleted

Categories

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

All
Other
enhancement

Tracking

(Not tracked)

RESOLVED WONTFIX

People

(Reporter: peter, Unassigned)

References

()

Details

:: Developer Documentation Request

      Request Type: Correction
     Gecko Version: unspecified
 Technical Contact: 

:: Details

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Logical_Operators
says:
"Even though the && and || operators can be used with operands that are not Boolean values, they can still be considered Boolean operators since their return values can always be converted to Boolean values."

This is problematic.  First, what does it even mean to be a "Boolean operator" ?  Where is the term defined?  The string "boolean op" does not appear in https://www.ecma-international.org/ecma-262/8.0/index.html.   Can you provide an example of an operator that is not a boolean operator?  Do you really mean to be talking about boolean contexts, and truthiness and falsiness?  Those are well covered elsewhere.

If your assertion is something like "any operator whose return values are always convertible to Boolean values must therefor be a Boolean operator" then you must confront this reply:

1) The ECMAScript language types are Undefined, Null, Boolean, String, Symbol, Number, and Object.  [6.1]
2) The toBoolean function always converts any value (of any of those types) to a Boolean value [7.1.2]

Therefor, every operator is a Boolean operator!

Please reconsider what purpose this sentence serves.  I assert it serves no purpose, and yet it is possibly misleading. If you removed the sentence, no harm would be done. 

What am I missing?
Thanks...
-Peter
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.