aboutsummaryrefslogtreecommitdiffstats
path: root/root/articles/mmmfs/examples/language_support/javascript/text$javascript -> mmm$dom.js
blob: de56531faf3ce98ba04db48058554c68790150c4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
const e = (elem, children) => {
  const node = document.createElement(elem);

  if (typeof children === 'string')
    node.innerText = children;
  else
    children.forEach(child => node.appendChild(child));

  return node;
};

return e('article', [
  e('h1', 'JavaScript'),
  e('p', 'JavaScript is supported natively in the browser but is not currently pre-rendered on the server.'),
]);