PHP
self, this :
Use $this to refer to the current object. Use self to refer to the current class. In other words, use $this->member for non-static members, use self::$member for static members.
https://stackoverflow.com/questions/151969/when-to-use-self-over-this
JS :
self, this :
var functionX = function() {
var self = this;
var functionY = function(y) {
// If we call "this" in here, we get a reference to functionY,
// but if we call "self" (defined earlier), we get a reference to function X.
}
}
JS - class can be created through function I.E var A = function () {}; var b = new A();
https://stackoverflow.com/questions/337878/var-self-this
No comments:
Post a Comment