JSFiddle - React, Tailwind, and code Playground

by clauswilke

JavaScript

a = [[1, 2, 3], [4, 5]]
b = a[0]
c = a.map((b) => [`M${b[0]}`,
     ...b.slice(1).map((x) => `L${x}`)
    ].join(' ')).join(' ') + ' Z'
console.log(c)