Using array.protoype.some I am trying to find a single instance of a property's value '' in an array of objects. If the value ''is found then variable round will be 0. Here is the codepen http://codepen.io/theMugician/pen/meNeoJ?editors=101
$scope.cells = [ { value: '', disabled: false },
{ value: '', disabled: false },
{ value: '' , disabled: false},
{ value: '' , disabled: false },
{ value: '' , disabled: false},
{ value: '', disabled: false } ,
{ value: '' , disabled: false},
{ value: '', disabled: false },
{ value: '' , disabled: false} ];
function hasValue(element) {
return element === '';
}
//check if all cells are filled
for(var i = 0; i < $scope.cells.length; i++){
if($scope.cells[i].value.some(hasValue)){
round = 0;
}else{
round = 1;
}
}
$scope.cellsand check the propertyvalue:of each object. If there is a single instance of''in the propertyvaluethen variableround = 0else (if there is no''in the propertyvaluein any of the objects) thenround = 1