What is a function?

Asked by
?
Curious Learner
1mo ago 0 views
1 answer
Best Answer
A reusable block of code that performs a task.

Example:
function add(a, b) {
return a + b;
}

add(2, 3); → returns 5

Benefits: Code reuse, modularity, organization.

Your Answer

Be specific and provide details to help the person asking.