Small doubt about this lesson

Dosn’t seems to me like a good idea to have that map inside the getter function call, because it isn’t static so we are now creating that map every time we us the getter, which maybe is not expensive, but still I don’t see why… :\

Like many other variables we are just creating the map as and when we require. Maybe we could shift the code to a setter to set and store the game difficulty.

Privacy & Terms