This is just a bunch of snippets from https://bonsaiden.github.io/JavaScript-Garden/ that might help you to learn the basics of Javascript.