I want a good variable name (constant name)

Asked 1 years ago, Updated 1 years ago, 36 views

I would like to put the appropriate variable name in the value below.Requirements are listed at the bottom.

var value=1000;// This

if(cart.totalPrice<value){
    handlingCharge = 100;
}

The processing is to set the fee to 100 if the total amount of the cart is less than 1000.
The content is abstracted.

The value is a constant rather than a variable, as we intend to have it externally as a setting.
Just in case, the handlingCharge is also a constant, so I'll let it go outside.

Requirements:
1.English
2. Name that is easy to understand and matches the processing content
3. Don't omit (can't make qty) ->I think it's okay to be long.
4.Finally, I will choose Upper Camel Case

By the way, what I thought of as having no sense is

MinimumPriceForHandlingCharge
ThresholdOfHandlingCharge

I'm feeling something rough and uncomfortable around here, so I'd like to use your wisdom.

javascript

2022-09-30 21:13

2 Answers

I have referred to the explanation of free shipping in Amazon USA, but how about MinimumOrderForFreeHandling or MinimumFreeHandlingOrder?


2022-09-30 21:13

How about NeedPriceForFreeOfHandlingCharge?
Shred it further NeedPriceForFreeHandling

EXITE TRANSLATION: If the purchase price is less than 1000 yen, I will charge 100 yen for the handling fee.
If the purchase price is less than [1000yen], I'll have 100yen as a handling charge.

This is what happens when you drop this English sentence directly into the source code.

if(the_purchase_price<1000_yen){
  handling_charge = 100;
}

If you're going to noun this 1,000 yen, you're going to say, "It's going to be a super-long noun with a lot of adjectives."
(In English, words and words are simple, but many adjectives are added…)

@ As Hideki mentioned, the word "Free",
Or something is required to replace it, and without it, I don't know what the noun is describing.

I am not very good at English either, but
I thought I wouldn't use this variable name, so I'll write it down.


2022-09-30 21:13

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.