Slacker News Slacker News logo featuring a lazy sloth with a folded newspaper hat
  • top
  • new
  • show
  • ask
  • jobs
Library
← Back to context

Comment by pwdisswordfishq

13 hours ago

Oh great, so where does DOM provide that function?

2 comments

pwdisswordfishq

Reply

mg  13 hours ago

The great thing with software is you can write your own functions. It would look something like this:

    function html(strings, ...values) {
      let result = strings[0];
      for (let i = 0; i < values.length; i++) {
        result += escapeHtml(values[i]);
        result += strings[i + 1];
      }
      return result;
    }

Slacker News

Product

  • API Reference
  • Hacker News RSS
  • Source on GitHub

Community

  • Support Ukraine
  • Equal Justice Initiative
  • GiveWell Charities