admin管理员组文章数量:1430567
I was trying to do something like this in console
var a = {title : '123'}
a && a.title //" 123"
but when I do this I have an error
{title : '123'} && '123'
**ERROR SyntaxError: Unexpected token &&**
I don't understand what conversions V8 did
I was trying to do something like this in console
var a = {title : '123'}
a && a.title //" 123"
but when I do this I have an error
{title : '123'} && '123'
**ERROR SyntaxError: Unexpected token &&**
I don't understand what conversions V8 did
Share Improve this question asked Mar 16, 2014 at 19:48 wrtwrt 211 silver badge4 bronze badges1 Answer
Reset to default 5The first part is parsed as a block with a label. So what follows is the start of a statement. &&
is a binary operator (meaning taking two operands), it can't start a statement.
Make the first part an expression by using parenthesis :
({title : '123'}) && '123'
本文标签: javascript error quotSyntaxError Unexpected token ampampquotStack Overflow
版权声明:本文标题:javascript error "SyntaxError: Unexpected token &&" - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745459741a2659267.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论