Created
May 13, 2013 16:14
-
-
Save eagleflo/5569516 to your computer and use it in GitHub Desktop.
js/null in ClojureScript 0.0-1806
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
; This fails with Uncaught ReferenceError: null$ is not defined | |
(defn foo [bar] (if (== js/null bar) "foo" "bar")) | |
;#< | |
;function foo(bar) { | |
; if ((null$ === bar)) { | |
; return "foo"; | |
; } else { | |
; return "bar"; | |
; } | |
;} | |
;> | |
; This works | |
(defn foo [bar] (if (nil? bar) "foo" "bar")) | |
;#< | |
;function foo(bar) { | |
; if ((bar == null)) { | |
; return "foo"; | |
; } else { | |
; return "bar"; | |
; } | |
;} | |
;> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment