Function

noun

say it: “FUNK-shun” /ˈfʌŋkʃən/

A named, reusable block of code that does one job. You can hand it values, and it can hand back a result.

What is Function in JavaScript?

Function — A reusable block of code that can receive values and return a result.

function total(price, quantity) {
    return price * quantity;
}

In a sentence

  • “I wrote a function called addTip so every receipt works out the tip the same way.”

Level: Apprentice · More JavaScript terms at this level

Updated

In other subjects