Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function cityTaxes(name, population, treasury) {
- let cityInfo = {};
- cityInfo.name = name;
- cityInfo.population = population;
- cityInfo.treasury = treasury;
- cityInfo.taxRate = 10;
- cityInfo.collectTaxes = collectTaxes = () =>
- (cityInfo.treasury += cityInfo.population * cityInfo.taxRate);
- cityInfo.applyGrowth = applyGrowth = (percentage) =>
- (cityInfo.population += Math.floor(cityInfo.population * percentage) / 100);
- cityInfo.applyPopulation = applyPopulation = (percentage) =>
- (cityInfo.treasury -= Math.floor(cityInfo.population * percentage));
- return cityInfo;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement