1
I’ve read several things about it,:
var classe = function () {
var metodo = function () {
return 0;
}
return {
init: function () {
metodo();
}
};
}();
jQuery(document).ready(function () {
classe.init();
});
First:
This is the correct way to instantiate classes/methods in javascript ? If not, how would the correct form be ?
Second:
JQuery methods are called cadentially:
$('#elemento').show().html('<html></html>').append('<div></div>').addClass('exemplo');
jQuery natively (without doing functions, only the original methods) can be considered an object orientation ?
jQuery methods give to chain because they all return one
jQuery
which is an object with the collection caught in the selector or changed if the last method has changed. You can confirm by consulting some of them in the documentation:show
,append
– Isac
@Anthraxis has already read in MDN documentation on classes in ES6?
– Woss
@Andersoncarloswoss this specific link that I command not yet, but it is very strange how javascript works, use is easy, the difficult is to know what you are doing D:
– AnthraxisBR