Coding Global Background
Coding Global

"Best practice" advise

Archived 2 years ago
7 messages
2 members
2 years ago
Open in Discord
D
DerPhil
Verified

Hey there o/ I recently started diving into HTML/CSS and now Javascript (on Codecademy) and I'm currently working my way through Javascript. Now I know that in programming, across all languages, there are do's and don'ts aka best practices. The below written code points to exactly that. I wonder if I should apply a certain "best practice" style or just find my own "best" style. So, are there more common ways to write a certain bit of code, or does it fully depend on my likings and maybe later on what the company wants? ['ne deutsche Antwort geht hier auch :p] ```js const fruits = ['mango', 'papaya', 'pineapple', 'apple']; // Iterate over fruits below fruits.forEach(fruit =>{ console.log("I want to eat a " + fruit); }) fruits.forEach(fruit => { console.log(`I want to eat a ${fruit}`); }) fruits.forEach(function(fruit){ console.log("I want to eat a " + fruit); }) ```

Replies (7)