Functions Basics
Functions group reusable steps. They take parameters and can return a value.
- function name() {} is a declaration (hoisted).
- const fn = function() {} is an expression.
- Always return explicitly when you need a value.
function add(a, b) {
return a + b;
}
console.log(add(2, 3));
After you read this chapter, use Write (when available) and Quiz on this page to lock it in.