re: Keeping Your Code Simple VIEW POST

TOP OF THREAD FULL DISCUSSION
re: Disagree about comments. Comments should tell the reader why not how. The reason there are comments in the first example was because I was applyin...
 

Fair enough, just keep in mind that documentation is different from comments.

I would just like to add something you might be interested in.
If you wanted your function "longestString" to be available outside of its package as a library function for example, you would want to comment using jsdoc.

More than it allows you to generate an html doc form your code, your IDE knows about jsdoc and can generate friendly popup as you try to use this function.
Have a look at the difference:

With jsdoc
Without jsdoc

Without jsdoc
With jsdoc

To finish, while being old (but definitely not irrelevant) and not JavaScript specific, I invite you to read Clean Code: A Handbook of Agile Software Craftsmanship from Robert C. Martin (Uncle Bob).

Cheers !

code of conduct - report abuse