Results 1 to 11 of 11
December 14th, 2011, 02:22 AM #1
December 14th, 2011, 05:08 AM #2
Please add some notes on triple equal '==='.
Originally Posted by Crockford
Does ternary operator includes here? Or that can be another tutorial on conditionals.
December 14th, 2011, 05:20 AM #3
Here's another case where I disagree with Crockford. I know exactly how == and === differ, have known for years, and still find that == is almost always what I want and intend. However, I wouldn't try to convince people to use one over the other like he has (in my opinion, unfortunately) done.
December 14th, 2011, 10:44 PM #4
December 15th, 2011, 03:16 AM #5
Nope, I'm just disagreeing with this one piece of his advice. (I said 'another' because there was another of his pieces of advice mentioned recently in a different thread.) I'm not saying anything as sensational as you're implying.
December 15th, 2011, 03:09 PM #6
Maybe it's good to point out that there are ways to write 'if' and 'if/else' statements using shorter syntax.
Not that I recommend to use them, as they are hard to read, but it's a good thing to know what these statements do...
A few examples:
if (variable_1 == 80) alert("something");
(variable_1 == 80) && alert("something");
variable_1 = some_property || 0;
alert( (variable_1==80) ? 'eighty' : 'not eighty' );
variable_1 = some_property ? 1 : 0;
December 15th, 2011, 06:37 PM #7
December 15th, 2011, 09:53 PM #8
December 16th, 2011, 06:35 AM #9
I think it would make sense to say in this tutorial that the condition for an if statement doesn't necessarily need to be a comparison between two operands. It can be any expression that evaluates to a boolean. It would then probably make sense to say what different literal values and complex objects resolve to when coerced.
We tolerate living and breathing. And niches.
Name Brand Watches
Maybe getTimer() or TweenMax is the answer to your problem . . .
December 16th, 2011, 07:11 AM #10Originally Posted by TheCanadian
I agree that the additional explanation that you suggested for the tutorial would be useful.
Originally Posted by TheCanadian
December 16th, 2011, 07:45 AM #11