Hacker News
new
|
past
|
comments
|
ask
|
show
|
jobs
|
submit
login
unwind
10 months ago
|
parent
|
context
|
favorite
| on:
Amazon to display tariff costs for consumers
Please don't use if:s to assign boolean literals, just do it:
const trump_tariff = priceIncrease > 1.0
also saves you from not initializing the variable in the default/other case. :)
Upvoter33
10 months ago
|
next
[–]
This was just someone showing you what the "Amazon programmer" was doing, and hence a deep cut reference to the likelihood of it being poor quality code :)
TheSoftwareGuy
10 months ago
|
parent
|
next
[–]
If you really wanted to look like Amazon codex you would write Java :)
maxvisser
10 months ago
|
root
|
parent
|
next
[–]
I see I missed an opportunity to make it even funnier.
throwaway519
10 months ago
|
prev
|
next
[–]
const
I feel you may underestimate how often they change.
grokkedit
10 months ago
|
prev
|
next
[–]
not to mention the mix of snake_case & camelCase
Someone
10 months ago
|
prev
|
next
[–]
In the original code,
trump_tariff
is a sticky value. If that’s intended/not intended, the above introduces/fixes a bug.
ImHereToVote
10 months ago
|
prev
[–]
If statements are great because they are highly readable.
Guidelines
|
FAQ
|
Lists
|
API
|
Security
|
Legal
|
Apply to YC
|
Contact
Search: