MENU
Function
A function isa block of code that can be run repeatedly by calling its name. It can take in values and return a value.
function sum(a, b) {
return a + b;
}
console.log(sum(10, 20));30
DRY (Don't Repeat Yourself) is a principle of software development. Effectively using functions makes the code not only shorter but also more maintainable.