12

so i'm playing around with coffee-script and got this behavior:

a? will translate to typeof a !== "undefined" && a !== null; - that's fine

the problem is if i try the same for a.foo?. this time it translate to a.foo != null; the same result i get for a[foo] also.

is there a "fast" way to check if a.foo is not null or undefined like there is with a?

mu is too short
  • 413,090
  • 67
  • 810
  • 771
Sagiv Ofek
  • 24,842
  • 7
  • 58
  • 53

0 Answers0