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
  • 426,620
  • 70
  • 833
  • 800
Sagiv Ofek
  • 25,190
  • 8
  • 60
  • 55

0 Answers0