Imagine a simple object:
function createObj(someValue) {
return {
someFunction: function () {
return someValue;
}
};
};
It basically does:
var obj = createObj("something");
var result = obj.someFunction(); // "something"
Now, someFunction
refers to a function that returns a value.
What should be the correct naming convention used in javascript for the someFunction
function?
Should it be named as what it does? Or its ok to name it with the name of the object that it returns?
I mean, should I name it value()
, or should I name it getValue()
? Why?
Thanks in advance.