

Star Map
To draw a constellation, the map needs to know how much sky to show. Write an arrow function getMapBounds(points) that takes an array of { x, y } points and returns { minX, maxX, minY, maxY, width, height }, where width and height are the size of the box.
An empty array returns a box of zeros.
Examples
getMapBounds([{ x: 2, y: 5 }, { x: 8, y: 1 }, { x: -3, y: 4 }])
→ { minX: -3, maxX: 8, minY: 1, maxY: 5, width: 11, height: 4 }
getMapBounds([])
→ { minX: 0, maxX: 0, minY: 0, maxY: 0, width: 0, height: 0 }
project.js
JAVASCRIPT
Saved as you type
Tests
0 of 3 passing- •three starsgetMapBounds([{ x: 2, y: 5 }, { x: 8, y: 1 }, { x: -3, y: 4 }])expected { minX: -3, maxX: 8, minY: 1, maxY: 5, width: 11, height: 4 }
- •no starsgetMapBounds([])expected { minX: 0, maxX: 0, minY: 0, maxY: 0, width: 0, height: 0 }
- •one stargetMapBounds([{ x: 4, y: -2 }])expected { minX: 4, maxX: 4, minY: -2, maxY: -2, width: 0, height: 0 }
On the line
+320 XP
Pass all 3 tests to claim it.
