snippets of plain js