In my knockout.js project I wrote some self invoking functions like this:
var addMarkers = function () { ko.utils.arrayForEach(self.sectionList(), function (sectionItem) { ko.utils.arrayForEach(sectionItem.placeList(), function (placeItem) { placeItem.marker.addListener('click', function () { map.panTo(placeItem.marker.getPosition()); }); }); }); }();
The function works without problems, however in JSLint the "var addMarkers" was highlighted as unused variable. That makes me wonder if I should the function like this, or just make anonymous because it is a better practice?:
function addMarkers (){ code to be executed };