M
M
magary42018-01-29 14:59:07
JavaScript
magary4, 2018-01-29 14:59:07

Extending a js class via Jquery.extend?

what are the pitfalls of this approach?

var Handler = {
    options: {},
    doSome: function() {
    },
    init: function() {
    }
}

var handler = $.extend(true,{},Handler);
handler.doSome = function() { переопределенная логика }
handler.init();

are there any nuances with closures when using this? how to address the members of the "class" inside it?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question