Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

javascript move array element to front

for(var i = 0; i<$scope.notes.length;i++){
	if($scope.notes[i].is_important){
    	var imortant_note = $scope.notes.splice(i,1);
    	$scope.notes.unshift(imortant_note[0]);//push to front
	}
}
 
PREVIOUS NEXT
Tagged: #javascript #move #array #element #front
ADD COMMENT
Topic
Name
3+4 =