JavaScript allows return statements to do assignment operations. Because it is hard to differentiate between an assignment and a comparison when written as part of the return statement, avoid using return statements.
Non-Compliant Code Examples
functionx() {returnresult=a*b;};functionx() {return(result)=(a*b);};functionx() {returnresult=a*b;};functionx() {return(result)=(a*b);};()=>{returnresult=a*b;};()=>result=a*b;functionx() {returnresult=a*b;};// Allow parens option not supported
// function x() { return (result = a * b); };
// function x() { return result || (result = a * b); };
functionfoo(){returna=b}functiondoSomething() {returnfoo=bar&&foo>0;}functiondoSomething() {returnfoo=function(){return(bar=bar1)}}functiondoSomething() {returnfoo=()=>a}functiondoSomething() {return()=>a=()=>b}functionfoo(a){returnfunctionbar(b){returna=b}}constfoo=(a)=>(b)=>a=b;