【发布时间】:2012-02-05 07:05:31
【问题描述】:
我正在使用 Jade 和
- if (userId !== null)
!= "<script type='text/javascript'>"
!= "userDetail.userId = "+userId.toString()+";"
- if (friends && friends.length > 0)
!= "userDetail.friends = "+friends+";"
!= "</script>"
在 Javascript 中,userDetail.js,
var userDetail = {};
userDetail.userId = null;
userDetail.friends = [];
当我运行它时,我得到 - Uncaught SyntaxError: Unexpected token ILLEGAL
我可以在 JS 中引用 userDetail.userId,但 userDetail.friends 显示为 null。 有什么线索吗?
friends 是一个对象数组 {id, name, _id}
【问题讨论】: