Coffeescript uses the survival operator to determine if a variable exists, and it shows that compiled And some unexpected What does the document say about The existence of the coffee script is the operator Then it will definitely say "no taco": If your The coffee script announces the variable inherently, therefore, Will you see that You say this: I have found that my version of coffeescript is only But it's not what it's doing, it's actually So if you know that the variable This will put a reference error in your face because On the other hand, check the guards for the investigation of Some
something will be compiled! == Undefined & amp; Amp; some! == Zero However I have noticed that my version of coffeescript only
something! == Zero was compiling in , so I wrote a test to see how this would affect my code.
Taco = Taco if undefined? Console.log "Fiesta!" Else console.log "No Taco!"
// generated by CoffeeScript 1.4.0 (function () {var taco; taco = zero =; (if Taco! =) Null) {console.log ("fiesta!");} Else {console.log ("no taco!"}}}}). Call (this);
did not output to Taco! So my question is two times why coffeescript does not check for
undefined value and why is it strong?
? :
? is not correct unless a variable null or undefined , which matches the value of the ruby
zero? / Code>
Taco = Taco if undefined? Console.log "Fiesta!" Else console.log "No Taco!"
taco is clearly
undefined then
taco? is incorrect.
? The javascript form depend on for example, if you only say so:
if taco? Console.log "Fiesta!" Else console.log "No Taco!"
Taco? becomes
typo taco! == "Undefined" & amp; Taco! == blank You can still check "this is
zero " (in a tight form), but there is also a "
var taco "; Note that
typo taco exam also checks for
taco = undefined , so a strict
! == The test can be used to see if
taco is
null .
something! == Faucet
something! = Zero is compiled for ; Use the "sloppy" type changing the inequality (
! == ) versus the inequality (
! = ), which you claim
! = and
! The difference between == is important here:
== (but
=== ) No
v has been declared (i.e.
var v Is anywhere) then
v is not
null , it is enough to see that
v! = Null neither
undefined However, if you do not know that
v has been announced, then you have a comparison of an undeclared variable with the
null To avoid referencing, a
typeof check is required . Consider this javascript:
if (tako! = Null) {console.log ("fiesta!"); } And {console.log ("no taco!"); }
taco does not exist:
if (type of taco ! == "Undefined" & amp; amp; Taco! == faucet) console.log ("fiesta!"); } And {console.log ("no taco!"); }
typeof which is nothing which has not been declared. I do not think you can use Backlit to build the first in coffeehouse without embedding javascript.
No comments:
Post a Comment