I am working with an array of objects containing elements such as position, name, and weight.
const elements = [{ position: 3, name: "Lithium", weight: 6.941, ... },{ position: 5, name: "Boron", weight: 10.811, ... }, { position: 6, name: "Carbon", weight: 12.0107, ... }]
What I want is to create a new array containing only the values of the 'position' key from the original array.
const resultArray = [3, 5, 6]
Can someone provide me with a TypeScript method to achieve this desired output?