Design Parking System LeetCode solution in JavaScript
1var ParkingSystem = function (big, medium, small) {2this.count = [big, medium, small];3};45/**6* @param {number} carType7* @return {boolean}8*/9ParkingSystem.prototype.addCar = function (carType) {10return this.count[carType - 1]-- > 0;11};1213/**14* Your ParkingSystem object will be instantiated and called as such:15* var obj = new ParkingSystem(big, medium, small)16* var param_1 = obj.addCar(carType)17*/