以下哪个表达式为 true?
true
assert.ok(String.raw`\n` === '\\n')
assert.ok(String.raw`\n` === '\n')
assert.ok(String.raw`\n` === 'n')
assert.ok(`\n` === '\\n')
assert.ok(`\n` === '\n')
assert.ok(`\n` === 'n')
答案
assert.ok(String.raw`\a` === '\\a')
assert.ok(String.raw`\a` === '\a')
assert.ok(String.raw`\a` === 'a')
assert.ok(`\a` === '\\a')
assert.ok(`\a` === '\a')
assert.ok(`\a` === 'a')
const a = 'abc'; console.log(`${{a}}`);
会发生什么?
'[object Object]'
'{a: "abc"}'
'{abc}'
'abc'