JavaScript: main