Why can\'t we directly use this
instead of self
in the following example?
function SeatReservation(name, initialMeal) {
var self =
It is usually done in order to keep a reference to this when the context is changing. It is often used in event handlers or callback functions. But as mentioned before, there is no reason to use it in your specific example.
You will find more details in the following article: http://www.alistapart.com/articles/getoutbindingsituations