I came across a certain way of placing a function inside a javascript object, which I do not quite understand. Typically, you have something like:
var obj = {
foo: function() {
return 'bar';
}
}
However, I found that I can get the same thing:
var obj = {
foo() {
return 'bar';
}
}
Is this another way to declare methods?
source
share