2
gvnix
5y

To all the JS experts here, please critique my code.
I have started learning JS a few days ago and wouldn't want to learn bad practices.

https://github.com/gauravat16/...

Comments
  • 4
    I aint gonna say shit about not using es6 classes but please im begging you stop using ajax
  • 1
    @ganjaman what's the alternative?
  • 5
  • 3
    @gvnix plus you could just use WebSockets for dynamic data fetch
  • 1
    keep it coming fellas :D I don't want to learn shit code.
  • 10
    Please stop using jQuery. It's completely unneeded. Look at fetch().

    Also, ES6. Learn it.
  • 3
    I don’t see what most of the comments are bringing to the party other than more lines to read exactly the same thing in the signature on the 1 line. I don’t do JavaScript but when i do I use typescript. And as others have said use the newer features and have a code transpiler convert it to older versions
  • 3
    @PrivateGER for simple webapps just use pure DOM (btw Visual Studio Code does that (they're madlads!))
  • 3
    You are using JSDoc incorrectly
  • 3
    Learn to use jquery, then learn how it is made and then drop it. That's the correct order of things. After all, current features are made by taking jquery as inspiration not negation. The 'fetch' and 'querySelectorAll' are best examples.

    Don't ask people to point your mistakes unless you are going to deeply analyzing why they are considered as mistakes. Sometimes the ugly, least idiomatic code that's flagged by all static code analyzers and linters is the best you can use. Google yourself 'quake magic number' as the best example. Look at all kind of loops that are there on the wild. All of them are slower than good old
    for(int i=0,max=list.size();i<max;i++){}
    \\ that's not JS
    But replacing those loops with the 'for' is a bad idea unless there are real performance benefits. Using jquery is a good idea, for example, if you are worried about outdated browsers.
Add Comment