Skip to content

Instantly share code, notes, and snippets.

@McLarenCollege
Last active January 3, 2022 08:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save McLarenCollege/3378e1ddbd13b81ffd082869448a46db to your computer and use it in GitHub Desktop.
Save McLarenCollege/3378e1ddbd13b81ffd082869448a46db to your computer and use it in GitHub Desktop.
Exercise : Delete True From Beginning of Array

Write code to remove all the true values from the begining of a boolean array 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 []

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment