Simulate a Parking Lot application in javascript

Michael Tong
1 min readNov 1, 2023
Photo by Ivana Cajina on Unsplash

Let’s say we have a small parking lot that can only take 5 cars at a time but at the same time there are 10 cars trying to park. Of course, with limited capacity we cannot park all the cars at once so these cars have to wait.

Let’s implement this in javascript where we take in 5 cars simulatenously but the remaining cars will wait until any of these cars left.

--

--