I have an array of currencies [\"GBP\", \"EUR\", \"NOK\", \"DKK\", \"SKE\", \"USD\", \"SEK\", \"BGN\"]
. I would like to order it by moving predefined list if th
var tabCurrency = ['GBP', 'EUR', 'NOK', 'DKK', 'SKE', 'USD', 'SEK', 'BGN'];
var tabPredef = ['EUR', 'USD', 'DKK', 'SKE', 'NOK', 'GBP'];
var newTabGood = [];
tabPredef.forEach(function (itemPredef, indexPref) {
var indexTemp;
tabCurrency.forEach(function (itemCurrency, indexCurrency) {
if(itemPredef == itemCurrency)
{
newTabGood.push(itemPredef);
indexTemp = indexCurrency;
}
})
tabCurrency.splice(indexTemp, 1)
})
var resultat = newTabGood.concat(tabCurrency);
console.log(resultat)