9
votes
Accepted
JavaScript program that calculates the sum and difference of a pair of numbers
Use const instead of let when possible
Declaring a variable with let tells JavaScript you ...
6
votes
JavaScript program that calculates the sum and difference of a pair of numbers
Procedural decomposition is a useful tool to manage complexity, and separation of "business logic" from user interaction common.
I think the naming of procedures can be improved here:
...
5
votes
JavaScript program that calculates the sum and difference of a pair of numbers
I'm not a JavaScript guy by any means, but I can apply what I know from related languages and let others shoot me down...
In setup(), I don't think we need the ...
4
votes
JavaScript program that calculates the sum and difference of a pair of numbers
I want to build on @Abion47's answer, because it hits on a lot of key points but misses two crucial items.
Your program should not just print successes; it should also print descriptive error ...
2
votes
JavaScript program that calculates the sum and difference of a pair of numbers
There are only two hard problems in computing: cache invalidation and getting programmers to pay attention to naming things.
Taking the time to figure out good names is the key to being a good ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
javascript × 9421jquery × 2239
html × 1057
performance × 840
node.js × 830
beginner × 686
ecmascript-6 × 629
css × 603
algorithm × 488
array × 398
object-oriented × 393
dom × 362
angular.js × 326
ajax × 299
react.js × 291
programming-challenge × 289
functional-programming × 276
html5 × 255
game × 235
json × 218
event-handling × 218
strings × 216
animation × 215
promise × 212
datetime × 195