Principle Three: Don't Repeat Yourself
This is a fundamental principle of modern web development. Don't be lazy. Write your own code.
- Principle Three Point Two: Use Libraries Wisely
- Move on to Principle Four: Don't Repeat Yourself (Again)
Example Time!
Here's an example of how to apply this principle:
function makePizza() {
var sauce = "marinara";
var cheese = "mozzarella";
var toppings = ["pepperoni", "mushrooms", "olives"];
return [sauce, cheese, toppings];
}
See, this function doesn't repeat itself at all!