Where can I find out how JavaScript-based inheritance works?

I'm trying to write JavaScript software, but it's hard for me to find the idea of ​​all this prototype and another evil kind of inheritance.

What I would like to know are the different ways to get inheritance, as well as the pros and cons of each of them.

+3
source share
5 answers

If you are writing Javascript, I highly recommend reading or watching Douglas Crockford. In particular, he has a conversation called Javascript: The Good Parts .

+3
source

"JavaScript: ", .

+2

You can try to use javascript not as a pure object-oriented language (which is not the case), but what uses functions and closures, which are its specifics.

function _class(init){
    var _private = init;
    return {
        _method:function(param){
            alert(_private + param);
        }
    };
};
_class('Stack')._method('Overflow');

If you have the courage to read / debug it, the jQuery source code is a very good example of using JavaScript.

+2
source

Check out this tutorial .

+1
source

Source: https://habr.com/ru/post/1732671/


All Articles