Task: Implement the Weather class in app/weather.js to determine storminess based on a number generator.
Requirements:
Create a CommonJS module that exports a Weather class.
The Weather class must be instantiable via new Weather().
Implement an instance method isStormy() that returns a boolean.
It should call this._numberGenerator() and return true if the generated number equals 0, and false otherwise.
Implement an instance method _numberGenerator() that returns a number in the range 0–9 ( inclusive ) by default.
This method must be accessible on the instance (not a private symbol); it should be possible for tests to spy on it using spyOn(weather, '_numberGenerator').
The default behavior of _numberGenerator() should be to return a random integer between 0 and 9.
Do not rely on external dependencies. The solution should live at /app/weather.js.
Example (for reference, but implement in the file):
isStormy() returns true when _numberGenerator() returns 0, otherwise false.
_numberGenerator() by default returns Math.floor(Math.random() * 10).