# Functions: arrows, parameters, this and callbacks

*JavaScript Developer Study Guide · Objects, Functions, and Classes · Last updated October 16, 2026 · https://www.certifyforce.com/study-guide/javascript-developer/objects-functions-and-classes/functions-arrows-parameters-this-and-callbacks*

How to pick the right function form for a requirement: passing references versus calling, arrow function syntax and limits, default, rest and destructured parameters, the rules that decide this (including call, apply, bind and callbacks), higher-order helpers, IIFEs and generators.

- Certification: Salesforce JavaScript Developer
- Exam section: Objects, Functions, and Classes
- Study guide: https://www.certifyforce.com/study-guide/javascript-developer

**Official exam objective:**

> Given a business requirement, locate the best function implementation.

## What the exam expects

- Given a requirement, choose between a function declaration, a function expression, an arrow function, an IIFE and a generator, and reject the forms that break.
- Pass a function as a callback by reference instead of calling it, and read what a callback-based snippet logs.
- Write parameters that meet a calling contract: defaults, rest parameters and destructured options objects.
- Predict `this` in a method call, a detached call, a callback, `call`/`apply`/`bind` and an arrow function, and pick the fix that restores it.
- Read higher-order helpers (`once`, memoize, curried factories) and predict their output.
- Key terms: **first-class function** (a value you can pass, return and store); **callback** (a function passed to another function to be called later); **higher-order function** (takes or returns a function); **lexical `this`** (an arrow function's `this`, taken from the scope where it was defined); **bound function** (a copy made by `bind` whose `this` and leading arguments are fixed).

## Key facts

| Fact | Detail | Source |
|---|---|---|
| Hoisting | Declarations hoist with their body; function expressions and arrows do not | [Functions (JavaScript Guide)](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Functions) |
| Concise arrow body | Returns its expression; a braced body without `return` returns `undefined` | [Arrow function expressions](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/Arrow_functions) |
| Arrow returning an object | Wrap the literal: `() => ({ a: 1 })` | [Arrow function expressions](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/Arrow_functions) |
| Arrow and `new` | Throws TypeError; arrows have no `prototype` | [Arrow function expressions](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/Arrow_functions) |
| Default trigger | Missing argument or `undefined` only; `null` and `0` are kept | [Default parameters](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/Default_parameters) |
| Rest parameter | One per function, last position, a real Array | [Rest parameters](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/rest_parameters) |
| Plain call `this` | `undefined` in strict mode, `globalThis` in non-strict code | [this](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/this) |
| `call` vs `apply` | Arguments listed individually vs as an array | [Function.prototype.apply()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/apply) |
| Re-binding | Binding a bound function again ignores the new `thisArg` | [Function.prototype.bind()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/bind) |
| Array method `thisArg` | `map(callbackFn, thisArg)` sets `this` for every callback call | [Array.prototype.map()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/map) |
| Object keys | Non-Symbol property names are coerced to strings | [Property accessors](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Property_accessors) |
| Generator call | Returns a generator; `next()` returns `{ value, done }` | [function*](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function*) |

## Check yourself

- Why does `orders.forEach(logOrder())` fail when `logOrder` returns nothing?
- When is a default parameter value used?
- Why does a regular `function` callback passed to `setTimeout` inside a method log `NaN` for `this.count++`?
- How do you make an arrow function return an object literal?
- What does calling a generator function return?

## Sources

- [Functions (JavaScript Guide)](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Functions)
- [Arrow function expressions](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/Arrow_functions)
- [this](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/this)
- [Functions (JavaScript Reference)](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions)
- [Function.prototype.bind()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/bind)
- [Function.prototype.call()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/call)
- [Function.prototype.apply()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/apply)
- [Default parameters](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/Default_parameters)
- [Rest parameters](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/rest_parameters)
- [Destructuring](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Destructuring)
- [Array.prototype.map()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/map)
- [Array.prototype.sort()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort)
- [Property accessors](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Property_accessors)
- [Closures](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Closures)
- [IIFE](https://developer.mozilla.org/en-US/docs/Glossary/IIFE)
- [function*](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function*)

## About the full unit

The "Core concepts", "Exam traps" and "Worked scenario" sections of this unit, its 15 linked practice questions, and unlimited timed mock exams are included with the JavaScript Developer pack (USD $19): https://www.certifyforce.com/practice-exams
