код должен выдавать 'One'. почему значения не сохраняется в strEval?
function wordedMath(expr) {
let arrExpr = expr.split(' ');
let arrayOfWords = ['zero', 'one', 'two', 'minus', 'plus'];
let arrayOfNumbers = ['0', '1', '2', '-', '+'];
let strEval = '';
arrExpr.forEach((item, i) => {
let cased = expr.toLowerCase();
if(cased.includes(arrayOfWords)) {
strEval += arrayOfNumbers[i]
}
});
let result = eval(strEval);
if(result === 1) result = 'One';
if(result === 2) result = 'Two';
if(result === 0) result = 'Zero';
return result;
};
console.log(wordedMath("zero Plus one"))