what am i doing wrong here?
const getLocale = (userConfig, knownLocales) => {
for (let i=0; i< knownLocales.length; i++){
return knownLocales[i]===userConfig.locale?userConfig.locale: "en";
}
}
Details
getLocale should be exported from the 'functions.js' file
getLocale should be a function
getLocale should return the string en if the locale isn't found in knownLocales
getLocale should return the locale if it's found in knownLocales
when i run the code, it returns all 'en', passed 1-3, and keep failing 4 over and over.