我在这里或在MDN上没有看到任何东西.我确定我只是遗漏了一些东西.这个地方必须有一些文件吗?
从功能上看,它看起来允许您将变量嵌套在字符串中,而无需使用+
运算符进行连接.我正在寻找有关此功能的文档.
例:
var string = 'this is a string';
console.log(`Insert a string here: ${string}`);
Run Code Online (Sandbox Code Playgroud) 如果我有一个包含许多标签的HTML块,如何在JavaScript中插入它?
var div = document.createElement('div');
div.setAttribute('class', 'post block bc2');
div.innerHTML = 'HERE TOO MUCH HTML that is much more than one line of code';
document.getElementById('posts').appendChild(div);
Run Code Online (Sandbox Code Playgroud)
我该怎么做?