Skip to content

Commit 8292aa1

Browse files
author
Jaskaran Singh
authored
Create parking_system.js
1 parent da14848 commit 8292aa1

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

parking_system.js

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
/**
2+
* @param {number} big
3+
* @param {number} medium
4+
* @param {number} small
5+
*/
6+
var ParkingSystem = function(big, medium, small) {
7+
this.parkingSlots = [big, medium, small];
8+
};
9+
10+
/**
11+
* @param {number} carType
12+
* @return {boolean}
13+
*/
14+
ParkingSystem.prototype.addCar = function(carType) {
15+
return this.parkingSlots[carType - 1]-- > 0;
16+
};
17+
18+
/**
19+
* Your ParkingSystem object will be instantiated and called as such:
20+
* var obj = new ParkingSystem(big, medium, small)
21+
* var param_1 = obj.addCar(carType)
22+
*/

0 commit comments

Comments
 (0)