ClojureScript中typeof ... undefined的类比是什么?

10

我看到很多代码使用这种模式:

if (typeof a.b === 'undefined') { ...
现在我正在翻译这个:
(if (nil? (-.b a)) ...

这个合适吗 - 还是我失去了一些关键的数据?

我的问题是:ClojureScript中类似于JavaScript的typeof ... undefined是什么?

1个回答

5

要检查可能的 undefined 引用,您可以使用cljs.core/exists?

(when-not (exists? js/unknownReference)
  ...)

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接