javascript中的概要
通过使用PHPStorm的inspect code工具,我得到以下消息:javascript中的概要,javascript,jslint,Javascript,Jslint,通过使用PHPStorm的inspect code工具,我得到以下消息: 'recipient_user.id === app.currentUser.id ? true : false' can be simplified to '!!(recipient_user.id === app.currentUser.id)' 我的问题是:因为jslint抱怨使用,是否建议根据PHPStorm更改代码?或者可以用更好的方式重写?我会将其更改为: recipient_user.id ===
'recipient_user.id === app.currentUser.id ? true : false'
can be simplified to
'!!(recipient_user.id === app.currentUser.id)'
我的问题是:因为jslint抱怨使用代码>,是否建议根据PHPStorm更改代码?或者可以用更好的方式重写?我会将其更改为:
recipient_user.id === app.currentUser.id
因为这保证返回一个真正的布尔值(true或false)。无需使用强制执行==
运算符的返回值代码>我将其更改为:
recipient_user.id === app.currentUser.id
因为这保证返回一个真正的布尔值(true或false)。无需使用强制执行==
运算符的返回值代码>