es6:
// 1)
if (activeNote) {
const node = document.querySelector(`#${activeNote}`);
node.children[0].innerHTML = title;
node.children[1].innerHTML = created.toLocaleString('en-US');
node.children[2].innerHTML = body;
node.style.backgroundColor = color;
activeNote = null;
}
// 2)
const node = document.querySelector('#listed');
node.appendChild(document.createTextNode(`${title} ${created.toLocaleString('en-US')} ${body} `));
// 3)
if (activeNote) {
const node = document.querySelector(`#${activeNote}`);
node.parentNode.removeChild(node);
activeNote = null;
}
// 4)
const nodes = document.querySelector(`#${id}`);
const titleSel = nodes.children[0].innerHTML;
const bodySel = nodes.children[2].innerHTML;