faced with difficulty which I can not solve = /

There are language settings by country:

"LANGUAGE": { "OPTIONS": ["en-US" , "rus-RU" , "zh-CN" , "fi-FI"], "FALLBACK": "en-US" 

start of code to get meaning:

 var regionalCod = Facade.config.LANGUAGE.OPTIONS, change_regionalCod = regionalCod, // здесь пытался извлечь значения через .toString().split("-")[1] change_regionalCodLow = change_regionalCod, // здесь менял формат .toLowerCase() regionalCod = change_regionalCodLow; console.log(regionalCod); 

console issues: enter image description here

But you need to give out: us, ru, cn, fi

Ie took only the country code written in large letters after the dash, changed to a small format and returned

as: ["us", "ru", "cn", "fi"] or simply "us", "ru", "cn", "fi"

preferably with the ability to then pull out any of the values ​​at will ...

    1 answer 1

    Here you can use the map function

     var regionalCod = Facade.config.LANGUAGE.OPTIONS.map(function(language){ return language.split('-')[1].toLowerCase(); }) 

    Example:

     var OPTIONS = ["en-US", "rus-RU", "zh-CN", "fi-FI"]; document.write('<div>' + JSON.stringify(OPTIONS) + '</div>'); var regionalCod = OPTIONS.map(function(language) { return language.split('-')[1].toLowerCase(); }); document.write('<div>' + JSON.stringify(regionalCod) + '</div>');