var cont = document.getElementById('rs') var ln = `\n` var line = `\n${'#'.repeat(64)}\n` let msg = "Hello World!" cont.textContent = msg cont.textContent += line cont.textContent += ln + `msg.startsWith("Hello"): ` + msg.startsWith("Hello") cont.textContent += ln + `msg.endsWith("!"): ` + msg.endsWith("!") cont.textContent += ln + `msg.includes("o"): ` + msg.includes("o") cont.textContent += line cont.textContent += ln + `msg.startsWith("o"): ` + msg.startsWith("o") cont.textContent += ln + `msg.endsWith("world!"): ` + msg.endsWith("world!") cont.textContent += ln + `msg.includes("x"): ` + msg.includes("x") cont.textContent += line cont.textContent += ln + `msg.startsWith("o", 4): ` + msg.startsWith("o", 4) cont.textContent += ln + `msg.endsWith("o", 8): ` + msg.endsWith("world!") cont.textContent += ln + `msg.includes("x"): ` + msg.includes("x")
<pre id="rs"></pre>