JavaScript Class method