30-Days-Of-JavaScript icon indicating copy to clipboard operation
30-Days-Of-JavaScript copied to clipboard

30-Days-Of-JavaScript/ Day 24

Open rmanikam opened this issue 2 years ago • 3 comments

Please provide me an api for solar system as I could not find api for it online.

rmanikam avatar Feb 04 '23 14:02 rmanikam

class GurvirBaraich {
	static GravityFinder = class {
		static #strengths = {
			mercury: 3.7,
			venus: 8.87,
			earth: 9.8,
			moon: 1.62,
			mars: 3.721,
			jupiter: 24.79,
			saturn: 10.44,
			uranus: 8.87,
			neptune: 11.15,
			pluto: 0.62,
		};

		/**
		 *
		 * @param {string} planetName
		 */

		static look(planetName) {
			if (typeof planetName !== "string") {
				throw new Error("planetName must be a string");
			}

			const field =
				GurvirBaraich.GravityFinder.#strengths[planetName.toLowerCase()];

			if (!field) {
				throw new Error("planetName is out of context");
			}

			return field;
		}
	};
}

console.log(GurvirBaraich.GravityFinder.look("mars")); // 3.721

gurvirbaraich avatar Feb 19 '23 06:02 gurvirbaraich

Can I add a js project?

Kedarnath-Rothe avatar Oct 23 '23 16:10 Kedarnath-Rothe

Can I add a js project?

??

gurvirbaraich avatar Oct 24 '23 09:10 gurvirbaraich