I had one question during interviews.
"Which of the following code snippets is more efficient?"
AppModule.controller('homeController', ['$scope', 'dep1', 'dep2', function($scope, dep1, dep2) {
...
$scope.aMethod = function() {
...
}
...
}]);
AppModule.controller('homeController', function($scope, dep1, dep2) {
...
$scope.aMethod = function() {
...
}
...
});
• Both are equally efficient.
• The second code is more efficient as it contains less code.
• The first code is more efficient because it holds names of dependencies.
• The second code is more efficient because it not contains additional an array.
I think the 3rd answer is right but not sure I'm right.
Please help me.