From 7faf623f1ca0bd2c850c88e2ebd45eee7ebf0c28 Mon Sep 17 00:00:00 2001 From: Kaio Rosa Date: Mon, 18 Mar 2019 15:13:49 -0300 Subject: [PATCH] Add files via upload --- Intermediate Algorithm Scripting/map-the-debris.json | 1 + 1 file changed, 1 insertion(+) create mode 100644 Intermediate Algorithm Scripting/map-the-debris.json diff --git a/Intermediate Algorithm Scripting/map-the-debris.json b/Intermediate Algorithm Scripting/map-the-debris.json new file mode 100644 index 0000000..3585c7c --- /dev/null +++ b/Intermediate Algorithm Scripting/map-the-debris.json @@ -0,0 +1 @@ +{"index.js":"function orbitalPeriod(arr) {\n var GM = 398600.4418;\n var earthRadius = 6367.4447;\n let newArr = [];\n // implement the conversion formula \n for(let avg in arr){\n let T = Math.round(2*Math.PI* Math.sqrt(Math.pow(earthRadius + arr[avg].avgAlt,3)/GM));\n // create the object with the specifications\n let newObj = {\n name: arr[avg].name,\n orbitalPeriod: T\n };\n // push it into a new array\n newArr.push(newObj);\n }\n \n return newArr;\n}\n\norbitalPeriod([{name : \"sputnik\", avgAlt : 35873.5553}]);"} \ No newline at end of file