Creating MVC classes in JavaScript