in , , ,

javascript.info/ninja-code

javascript.info/ninja-code | developer-memes, javascript-memes, code-memes, java-memes, variables-memes, try-memes, data-memes, rest-memes, search-memes, IT-memes, idea-memes, ide-memes, variable name-memes, language-memes, feature-memes | ProgrammerHumor.io
developer-memes, javascript-memes, code-memes, java-memes, variables-memes, try-memes, data-memes, rest-memes, search-memes, IT-memes, idea-memes, ide-memes, variable name-memes, language-memes, feature-memes | ProgrammerHumor.io

Content

Brevity is the soul of wit Make the code as short as possible. Show how smart you are. Let subtle language features guide you. For instance, take a look at this ternary operator ‘?’ : 1 taken from a well-known javascript library 2 i i? i 0? Math.max(0, len i) : i: 0; Cool, right? If you write like that, a developer who comes across this line and tries to understand what is the value of i is going to have a merry time. Then come to you, seeking for an answer. One-letter variables Another way to code shorter is to use single-letter variable names everywhere. Like a, b or c. A short variable disappears in the code like a real ninia in the forest. No one will be able to find it using "search" of the editor. And even if someone does, they won’t be able to "decipher" what the name a or b means. Soar high. Be abstract. While choosing a name try to use the most abstract word. Like obj, data, value, item, elem and so on. The ideal name for a variable is data . Use it everywhere you can. Indeed, every variable holds data, right? ProarammerHumor.io