LLD - Design — Parking Lot System
Given the following code snippet for two parking strategies, what will be the output when
findSpot(vehicle) is called using NearestParkingStrategy?
class NearestParkingStrategy {
findSpot(vehicle) {
return "Nearest spot found";
}
}
class RandomParkingStrategy {
findSpot(vehicle) {
return "Random spot found";
}
}
const strategy = new NearestParkingStrategy();
console.log(strategy.findSpot('car'));