JavaScript: Class template