![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
Is '===' a valid operator in javascript? Here is the output from jslint: Problem at line 155 character 48: Use '===' to compare with '0'. if(Annotation._rowelem.childNodes.length == 0) { |
#3
| |||
| |||
|
|
Is '===' a valid operator in javascript? |
|
Here is the output from jslint: Problem at line 155 character 48: Use '===' to compare with '0'. |
|
if(Annotation._rowelem.childNodes.length == 0) { |
#4
| ||||
| ||||
|
|
"James Black" [...] wrote [...]: Is '===' a valid operator in javascript? Here is the output from jslint: Problem at line 155 character 48: Use '===' to compare with '0'. if(Annotation._rowelem.childNodes.length == 0) { According to http://www.w3schools.com/js/js_operators.asp It is a valid comparison operator. |
|
the === operator returns true if both operands have the same value and are the same type. |
|
(5 === "5") would return false according to those rules |
|
Is that 'strict equality' ? |
#5
| |||
| |||
|
|
Is '===' a valid operator in javascript? Here is the output from jslint: Problem at line 155 character 48: Use '===' to compare with '0'. if(Annotation._rowelem.childNodes.length == 0) { |
#6
| |||
| |||
|
|
Hal Rosser wrote: "James Black" [...] wrote [...]: Is '===' a valid operator in javascript? Here is the output from jslint: Problem at line 155 character 48: Use '===' to compare with '0'. if(Annotation._rowelem.childNodes.length == 0) { According to http://www.w3schools.com/js/js_operators.asp It is a valid comparison operator. One of the few occasions where w3schools.com is correct. Stop referring to it, ************** |
|
the newsgroup's FAQ, and in the en.Wikipedia articles about JavaScript, JScript, and ECMAScript. the === operator returns true if both operands have the same value and are the same type. True. (5 === "5") would return false according to those rules Correct. Is that 'strict equality' ? It is. `==' involves implicit type conversion of operands if required, `===' does not. PointedEars |
#7
| |||
| |||
|
|
James Black wrote: Is '===' a valid operator in javascript? It is. See <http://pointedears.de/scripts/js-version-info> for details. |
#8
| |||
| |||
|
|
[...] In a language as loose as JavaScript, rigor in expression can help improve the resilience and portability of our programs. |
#9
| |||
| |||
|
|
For example, as I said, the `===' operator is not fully backwards compatible. |
#10
| ||||
| ||||
|
|
Thomas 'PointedEars' Lahn napisal(a): For example, as I said, the `===' operator is not fully backwards compatible. This always depends on requirements of the software you write, which every good project has (and well paid of). The operators like === or !== or 'delete' (since NN4, IE4 - ~October 1997) |
|
are very often used to provide better flexibility on understanding program code. |
|
The same are anonymous and named function expressions (very usefull). |
|
If you persist on not using ===, you must use some sort of emulation of it, [...] |
![]() |
| Thread Tools | |
| Display Modes | |
| |