You are viewing a single comment's thread from:

RE: Block.ops - An Analysis Tool - Account Creation, Account Claiming, Follows, Unfollows, Reblogs, Power Ups, Power Downs and More!

in #utopian-io6 years ago

Thank you very much for this intensive contribution.

  1. In blockOps.js you are using async/await - which is great but in mongoblock.js you are using Promise - which makes the code a lot messier.
  2. sometimes you are using == to compare the boolean values (you should stick to ===).
  3. and there is inconsistency of using semi-colon or not at each line. After JS-Minified, the JS code without semi-colons may have a problem.
  4. Despite let in most places, you are also using var sometimes, in a for loop, please be noted that the var will lift up the variables and create unpredicted problems. It is in general a good practice to start using let or const.
  5. Most functions are too big... You might want to break down a little bit - remember One function should only does one thing (Single Responsibility)

Overall, this is a nice piece of work!

Your contribution has been evaluated according to Utopian policies and guidelines, as well as a predefined set of questions pertaining to the category.

To view those questions and the relevant answers related to your post, click here.


Need help? Write a ticket on https://support.utopian.io/.
Chat with us on Discord.
[utopian-moderator]

Sort:  

Thanks @justyy. That's some great feedback. And very prompt!

Just a question on 4. (let vs var)...
I use atom as my code editor. When I start a for loop it automatically prompts with this default code:

for (var i = 0; i < array.length; i++) {
array[i]
}

I've now had feedback on both the var being a bad choice and the i++ being dangerous. Is it just bad code?

There are different opinions, I wouldn't consider this is a bad code. The JS is evolving quickly, especially the ES6, ES7 or even ES8, so you will find some syntax sugars e.g. even to replace the for loop with map, reduce and filter.. The old-style JS still works but depreciated.

Thank you for your review, @justyy! Keep up the good work!

Coin Marketplace

STEEM 0.29
TRX 0.12
JST 0.032
BTC 63410.49
ETH 3058.61
USDT 1.00
SBD 3.99