Some code snippets in Javascript