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

[text] 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 wellknown javascript library 2 i171i0 77 Math.max0 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. Oneletter variables Another way to code shorter is to use singleletter variable names everywhere. Like a b or c. A short variable disappears in the code like a real ninja in the forest. No one will be able to find it using search of the editor. And even if someone does they wont 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