Array.map()
const xdata = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
const ydata = xdata.map((item) => (item ** 2));
console.log(ydata);
[
1, 4, 9, 16, 25,
36, 49, 64, 81, 100
]
const xdata = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
const ydata = xdata.map((item) => (item ** 2));
console.log(ydata);
[
1, 4, 9, 16, 25,
36, 49, 64, 81, 100
]