3 ms·
Is there any significant difference between that and element.innerHTML=` <p>Today is ${new Date().toDateString()}</p> <p>Random number: ${Math.
by Lerc 1y ago
Is there any significant difference between that and
element.innerHTML=`
<p>Today is ${new Date().toDateString()}</p>
<p>Random number: ${Math.floor(Math.random() * 100)}</p>
`
(ideally .setHTML() when it's available)
At that point I think I'd have a skeleton html file that fetches a JS that does it all. I'd take JS with embedded HTML over HTML with embedded JS.
- fooqux 1y agoIsn't it wonderful that we live in a world where both ways can exist together, along with a myriad of other ideas for how to do the exact same thing?
- Kiro 1y agoThe point is that both ways contain the same "spaghetti" that the OP is complaining about and that it's unclear what alternative they actually prefer.
- worik 1y agoNo. But you can write dreadful code in any language