scrimba
21 web dev tips for 2021 🎇
Tip 1.1 : Clean Code Part 1
Go Pro!Bootcamp

Bootcamp

Study group

Collaborate with peers in your dedicated #study-group channel.

Code reviews

Submit projects for review using the /review command in your #code-reviews channel

Tip 1.1 : Clean Code Part 1
AboutCommentsNotes
Tip 1.1 : Clean Code Part 1
Expand for more info
index.js
run
preview
console
// Clean Code Examples Part One - JavaScript

// 1. Use camelCase for functions
function getnames () {

}


// 2. Declare your variables
names = ['Leo', 'Paul']


// 3. Keep your quotation marks consistent
let names = ['Hannah', "Lee", 'Jude']



// 4. Make sure your function names make sense and are not too convoluted
let names = ['Dave', 'Ania', 'Farooq']

function sortedNamesInAlphabeticalOrder () {
names.sort()
console.log(names)
}
Console
›
Error: SyntaxError: unknown: Identifier 'names' has already been declared (19:4) 17 | 18 | // 4. Make sure your function names make sense and are not too convoluted > 19 | let names = ['Dave', 'Ania', 'Farooq'] | ^ 20 | 21 | function sortedNamesInAlphabeticalOrder () { 22 | names.sort() (/index.js:19)
,
/index.html
-5:25