![](/img/trans.png)
[英]Getting the error that Expected an assignment or function call and instead saw an expression no-unused-expressions?
[英]Expected an assignment or function call and instead saw an expression no-unused-expressions - how to fix this CI error?
预期分配或 function 调用,而是看到一个表达式 no-unused-expressions,我需要帮助来解决这个问题。 谢谢
export const setDecimalFormat = amount => { ['de', 'fr'].includes(getLocale())? amount.replace(/\./g, ','): amount; };
尝试返回值
如果箭头 function 只是返回一行代码,则可以省略语句括号和 return 关键字。 这告诉箭头 function 返回语句。
export const setDecimalFormat = amount => {
return ['de' , 'fr'].includes(getLocale())
? amount.replace(/\./g, ',')
: amount;
};
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.