by bshimmin · 11y ago · 0 comments
3.3 Use readable synonyms in place of reserved words.
// bad
const superman = {
class: 'alien',
};
// bad
const superman = {
klass: 'alien',
};
What is unreadable about "klass"? Rails, for example, uses "klass" and it's never been hard for me (or, I suspect, anyone) to understand."Make sure you set the class-with-a-k property to 'alien'."
"Make sure you set the type property to 'alien'."
It's confufing to use one name inside your code and different one elsewhere.