checking for undefined variable with Underscore.js

后端 未结 2 681
情歌与酒
情歌与酒 2021-01-15 12:53

I\'m having a problem with Underscore.js templates and Internet Explorer. Here\'s part of the template which is causing trouble:

<% if ( typeo

2条回答
  •  北恋
    北恋 (楼主)
    2021-01-15 13:21

    If you typeof something and the something is null, object is returned. Try checking for null after checking for 'undefined'.

提交回复
热议问题