← Back to challenges

X and Y Coordinates

JavaScriptHardarraysnumbers

Instructions

Create a function that converts two arrays of x- and y- coordinates into an array of (x, y) coordinates.

Examples

convertCartesian([1, 5, 3, 3, 4], [5, 8, 9, 1, 0])
➞ [[1, 5], [5, 8], [3, 9], [3, 1], [4, 0]]

convertCartesian([9, 8, 3], [1, 1, 1])
➞ [[9, 1], [8, 1], [3, 1]]

Notes

x and y arrays will always be the same length.

javascript
Loading editor…
to run
Walks through the solution with reasoning and edge cases.
Next: Reverse and Capitalize