Arrow Functions

Verze:

31. 12. 2025

Zodpovědná osoba:

Dominik Šlechta

Arrow functions MUST be used for callbacks and inline functions. Implicit return SHOULD omit braces and return keyword.

Arrow functions MUST be used for callbacks and inline functions.

Arrow functions with a single parameter MAY omit parentheses.

Arrow functions with implicit return SHOULD omit braces and return keyword.

Example (Correct):

const items = products.filter(p => p.active)
const doubled = numbers.map(n => n * 2)

// Complex logic with braces
const processed = items.map(item => {
    const price = calculatePrice(item)
    return { ...item, price }
})