constexpressionMatters=(a,b,c)=>{[a,b,c].forEach((n,i)=>{if(n<1)thrownewError(`Operand at index: ${i} with value: ${n}
is less than 1. All operands must be greater than 0 and less than 11`);elseif(n>10)thrownewError(`Operand at index: ${i} with value: ${n}
is greater than 10. All operands must be greater than zero and less than 11`);});constresults=[];results[0]=a*(b+c);results[1]=a*b*c;results[2]=a*b+c;results[3]=a+b*c;results[4]=(a+b)*c;results[5]=a+b+c;returnMath.max(...results);}console.log(expressionMatters(1,2,3));// 9console.log(expressionMatters(1,1,1));// 3console.log(expressionMatters(9,1,1));// 18
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
JavaScript Solution