Skip to content

Instantly share code, notes, and snippets.

@DenisIzmaylov DenisIzmaylov/case-1.js
Last active Dec 16, 2019

Embed
What would you like to do?
Clean Code?
// Bad
books.forEach(book => {
if (book[title]) {
if (book[author]) {
console.log(book)
}
}
})
// Good
books.forEach(book => {
if (!book[title]) return
if (!book[author]) return
console.log(book)
}
// Bad
const hoursByDates = {}
hoursByDates['2019-12-01'] = 4
// Good
const hoursByDate = {}
hoursByDate['2019-12-01'] = 4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.