Question

I would like to be sure I am using the most common naming convention. In the example below would it be more common for deleteEntity to be deleteEntity or DeleteEntity?

var factory = {
    deleteEntity: function (entityType, entityId) {
        var deferred = $q.defer();
        EntityResource.deleteEntity({ entityType: entityType, entityId: entityId },
           function (resp) {
               deferred.resolve(resp);
           }
        );
        return deferred.promise;
    },
Was it helpful?

Solution

It would be more common to be lowercase. It would still work, but generally capital Functions are reserved for constructors (i.e. used with the new keyword).

OTHER TIPS

There are no set naming conventions that I know of as such. But as a Java developer, I will be happy to see variables and methods following lower Camel Casing like deleteEntity. But Dot net developers may be comfortable with Upper camel casing like "DeleteEntity".

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top