Skip to content

Instantly share code, notes, and snippets.

@IrhaAli
Created October 7, 2022 19:11
Show Gist options
  • Save IrhaAli/71f6133b7297a75be83fe907d47a6092 to your computer and use it in GitHub Desktop.
Save IrhaAli/71f6133b7297a75be83fe907d47a6092 to your computer and use it in GitHub Desktop.
Returns spot to part at, if available.
const whereCanIPark = function (spots, vehicle) {
//look through each row
for (let i = 0; i < spots.length; i++){
//look through each column
for (let j = 0; j < spots[i].length; j++){
if (spots[i][j] === vehicle[0].toUpperCase()){
return [j,i];
}
}
}
return false;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment