Javascript Function and Classical OOP