代码格式化是这样的:
if (flag == 1 && yemian.shop_price == ‘0.00’) {
if (yemian.member_price != ‘0.00’) {
yemian.shop_price = yemian.member_price;
} else if (yemian.retail_price != ‘0.00’) {
yemian.shop_price = yemian.retail_price;
}
}
可不可以做成这样:
if (flag == 1 && yemian.shop_price == ‘0.00’)
{
if (yemian.member_price != ‘0.00’)
{
yemian.shop_price = yemian.member_price;
}
else if (yemian.retail_price != ‘0.00’)
{
yemian.shop_price = yemian.retail_price;
}
}
这样感觉很清晰