0
Several references mention syntax commands Javascript as addEventListener()
, pop()
, querySelector()
and etc as methods:
But the very MDN Web Docs defines these commands as functions and not methods:
So I stopped here I don’t know what the differences between the two in the case for me so far a method is a function within an object:
let a = {
b: function() {
return "Olá";
}
}
So if I wanted to, for example, check if an element has a certain class I would have to write something like classList.container('class1')
that is to say classList
is an object and I am accessing your method which is container()
.
Already a function for me is something that does not have the need to declare something earlier as, by exeplo:
function res(a, b) {
return a * b;
}
That is my view, but on the question of right or wrong what is the difference between the two terms?
It also addresses the theme: https://answall.com/questions/212265/fun%C3%A7%C3%A3o-e-m%C3%A9todo-s%C3%A3o-a-mesma-coisa
– Daniel Mendes
This answers your question? Definitions of method, function and procedure?
– Daniel Mendes
Vlw! by the references although not having a concrete source of the specification beyond Wikipedia deducing the real meaning of each of the terms I will continue with the above thinking and that of the answers of the links cited.
– marquinho