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.
RESETRUNFULL
<!DOCTYPE html><html><body><script>
function sum(a,b){return a+b;}console.log(sum(10,20)); // 30
</script></body><html>
DRY (Don't Repeat Yourself) is a principle of software development. Effectively using functions makes the code not only shorter but also more maintainable.