Big O Notation: Linear Time

const lineOfPeople = [{"name": "Tom", "age": 18}, {"name": "Scott", "age": 24} {"name": "Mary", "age": 21}]function allowEntrance(array){
for(let i = 0; i < array.length; i++){
if(array[i].age > 20){
console.log(`${array[i].name} is ${array[i].age} and can enter`)
} else {
console.log(`${array[i].name} is too young to enter`)
}
}
}
allowEntrance(lineOfPeople)
Tom is too young to enter
Scott is 24 and can enter
Mary is 21 and can enter

--

--

--

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

The browser innovation that could make Multi-Page apps great again

Solving Popular Algorithms: Self Dividing Numbers

N+ 1 way of background location tracking on React Native.

🏁 React Final Form HTML5 Validation

5 Visual Studio Code Extension I’ve been using as a Front-End Engineer

Pros and Cons of JavaScript: Choose Wisely

Community Q&A Monthly Digest — May 2020

Golang: Building Dynamic URLs

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Dean

Dean

More from Medium

GRWM — Get Reading With Me #1

CS373 Spring 2022: Ali Al-Adhami, Week 11

My 2 cents of learning

What Does Frugal Mean Precisely?