I find this to be useful:

cljs.user> (nil? (.-key (js-obj)))
true

I like not having to use undefined? for this


On Tue, Jan 15, 2013 at 1:08 AM, Frank Siebenlist <
[email protected]> wrote:

> ClojureScript:cljs.user> (def a nil)
> nil
> ClojureScript:cljs.user> (def b)
>
> ClojureScript:cljs.user> (= a b)
> true
> --------
> user=> (def a nil)
> #'user/a
> user=> (def b)
> #'user/b
> user=> (= a b)
> false
> --------
>
> I didn't realize that the above is dark cave material ;-)
>
> Could you elaborate a little on the desirable aspect?
> (I'm not arguing - only trying to understand as I have just been bitten by
> this behavior)
>
> Thanks, FrankS.
>
>
>
>
> On Jan 14, 2013, at 9:25 PM, David Nolen <[email protected]> wrote:
>
> > This behavior is desirable. Unless you are in some dark cave of interop
> you shouldn't care.
> >
> > On Tuesday, January 15, 2013, Frank Siebenlist wrote:
> > ClojureScript:cljs.user> (def a nil)
> > nil
> > ClojureScript:cljs.user> (def b)
> >
> > ClojureScript:cljs.user> (undefined? a)
> > false
> > ClojureScript:cljs.user> (undefined? b)
> > true
> > ClojureScript:cljs.user> (nil? a)
> > true
> > ClojureScript:cljs.user> (nil? b)
> > true
> > ClojureScript:cljs.user> (type a)
> > nil
> > ClojureScript:cljs.user> (type b)
> > nil
> > ClojureScript:cljs.user> (goog.typeOf a)
> > "null"
> > ClojureScript:cljs.user> (goog.typeOf b)
> > "undefined"
> > ClojureScript:cljs.user> (= a b)
> > true
> >
> >
> > That doesn't feel right… does it?
> >
> > Definitely different from clojure… although it's difficult to compare
> without vars in cljs.
> >
> > -FrankS.
> >
> >
> >
> > --
> > You received this message because you are subscribed to the Google
> > Groups "Clojure" group.
> > To post to this group, send email to [email protected]
> > Note that posts from new members are moderated - please be patient with
> your first post.
> > To unsubscribe from this group, send email to
> > [email protected]
> > For more options, visit this group at
> > http://groups.google.com/group/clojure?hl=en
> >
> > --
> > You received this message because you are subscribed to the Google
> > Groups "Clojure" group.
> > To post to this group, send email to [email protected]
> > Note that posts from new members are moderated - please be patient with
> your first post.
> > To unsubscribe from this group, send email to
> > [email protected]
> > For more options, visit this group at
> > http://groups.google.com/group/clojure?hl=en
>
> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to [email protected]
> Note that posts from new members are moderated - please be patient with
> your first post.
> To unsubscribe from this group, send email to
> [email protected]
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
>

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to