Public
Edited
Dec 4, 2023
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
nums = inputArr.map((i) => {
const nums = i.match(/\d/g);
const [first, ...rest] = nums;
const [last] = nums.reverse();

if (nums.length === 1) {
return first + first;
}

return first + last;
})
Insert cell
nums.reduce((acc, i) => {
acc = acc + parseInt(i, 10);

return acc;
}, 0)
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more