Skip to content

Latest commit

 

History

History
17 lines (14 loc) · 600 Bytes

delete-true-from-the-beginning.md

File metadata and controls

17 lines (14 loc) · 600 Bytes

Write code to remove all the true values from the begining of a boolean array until you encounter a false and returns the modified array.

HINT : Consider using a while loop instead of a for loop

CODE TEMPLATE


function deleteTrueFromBeginning(arr){
// write your code here
}
let arr = [true,true,false,false,false,true,true,false];
console.log(deleteTrueFromBeginning(arr));// should return [false,false,false,true,true,false]
arr = [true,true,true,true,true];
console.log(deleteTrueFromBeginning(arr));// should return []