Apologies for my beginner question, but JavaScript is new to me.
I am working with the following arrays:
const files = ['pt_rBR.xlf', 'it.xlf', 'es.xlf']
const language_map = [{'file': 'de.xlf', 'lang': 'de_DE'},{'file': 'es.xlf', 'lang': 'es_ES'},{'file': 'it.xlf', 'lang': 'it_IT'},{'file': 'pt-rBR.xlf', 'lang': 'pt_BR'}]
My goal is to create a new array where the elements of the "files" array are replaced by values from the "language_map" array - matching keys and values. This would look like:
languages = ['pt_BR', 'it_IT', 'es_ES']
How can I achieve this? I understand that I can loop through the "files" array using:
for (const element of files) {
console.log(element);
}
But how do I actually perform the replacement and generate the new array?
Thank you