snippets of javascript code