I'm wondering why a framework like EmberJS uses the _super
method for calling the overridden method on the extended object instead of the (in my opinion) more logical this.super
.
Is there a specific reason for this, for instance that super
is a reserved keyword in javascript? So you cannot assign variables or named functions to the name super
. The function assigned to this.super
is an anonymous function right?
_super may be used to differenate it between other functions that may have been set. This could have been to show how it's special, or different than other variables. Or it could be to show it's private.
See:
When do you make an underscore in front of an instance variable?
How does an underscore in front of a variable in a cocoa objective-c class work?
Why do we use _ in variable names?
EDIT: Like Barmar said (except in much less words) it's a coding style, nothing else.
_
indicates a private member. You're only supposed to access _super
from inside the class, never from the outside.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.