I have
<code>[1, 3, 5]
</code>
<code>[1, 3, 5]
</code>
[1, 3, 5]
and try to get
<code>[{val:2}, {val:6}, {val:10}]
</code>
<code>[{val:2}, {val:6}, {val:10}]
</code>
[{val:2}, {val:6}, {val:10}]
My Code:
<code>const array1 = [1, 3, 5];
const map1 = array1.map ((x) => {val: x * 2});
</code>
<code>const array1 = [1, 3, 5];
const map1 = array1.map ((x) => {val: x * 2});
</code>
const array1 = [1, 3, 5];
const map1 = array1.map ((x) => {val: x * 2});
But what I get is just
<code>[undefined, undefined, undefined]
</code>
<code>[undefined, undefined, undefined]
</code>
[undefined, undefined, undefined]
How can I modify my simple code make it work with a lambda-construct?