Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

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.



Isn'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?


The 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.


No.

But you can write dreadful code in any language




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: