dreamcode
Return to projects
Project Workshop · Star Map
IndependentJavaScript
Reward: +320 XP

Star Map

Write an arrow function `getMapBounds(points)` that takes an array of points, where each point is an object `{ x: number, y: number }`. Return an object `{ minX, maxX, minY, maxY }` representing the bounding box. If the array is empty, return `{ minX: 0, maxX: 0, minY: 0, maxY: 0 }`.

TEST SPECIFICATION
getMapBounds(points with coords)
{"minX":-3,"maxX":8,"minY":1,"maxY":5}
getMapBounds([])
{"minX":0,"maxX":0,"minY":0,"maxY":0}
project.js
JAVASCRIPT
Local compilation ready
Unit Tests · 0 / 2 passed
·points with coords → run to test
·[] → run to test
PROJECT WORKSHOP
Star Map
Fulfill specification to complete
+320 XP