I am new to Javascript and Angular and am a bit confused as to how the below code is executing:
angular.controller('TestController',function($scope){
$scope.counter = {clicks:0};
$scope.count = function(){
$scope.clicks += 1;
}
});
I am able to write $scope.clicks += 1 and the count increases correctly by 1. Isn't counter a Javascript object and dont we have to write it as $scope.counter.clicks += 1?