Reputation: 6031
This works:
alert('foo\
bar'
)
But this is causing syntax error:
t='test';
alert('<tr><td><b>' + t + '</b></td>\
<td></td><td>')
error is:
SyntaxError: unterminated string literal
They two should be the same thing, why the first one works, while the second fails?
Upvotes: 5
Views: 216
Reputation: 19290
You have a trailing space after your backslash in the second example.
Upvotes: 3