A function can have properties, yet `example()` works and `({})()` throws. Both values are objects; the difference is an internal capability. A function inherits from `Function.prototype` and has a `[[Call]]` slot that makes it callable. `typeof` reports `"function"`, but that label does not make functions a separate kind of property container. section 6.1
An object you can call
Define `function example() {}` and set `example.customProperty = 'hello'`. `example instanceof Object` is true, and `Object.keys(example)` can list the assigned property. Calling `example()` also works; calling an ordinary object does not. section 6.1
Other inaccessible slots account for other behavior. `[[Construct]]` permits construction with `new`; arrow functions lack it, so `new` on an arrow throws. `[[Environment]]` links a function to the scope where it was created, enabling closures. You cannot read or assign these slots in JavaScript. section 6.1
Table 6.1 The four forms of functions create very real differences in behavior
|
Capability
|
Declaration
|
Expression
|
Arrow
|
Class
|
|
Has [[Construct]]
|
✓
|
✓
|
✗
|
✓
|
|
Has own this binding
|
✓
|
✓
|
✗
|
✓
|
|
Has arguments object
|
✓
|
✓
|
✗
|
✓
|
|
Has prototype property
|
✓
|
✓
|
✗
|
✓
|
|
Hoisted
|
✓
|
|
✗
|
✗
|
|
Requires new
|
✗
|
✗
|
N/A
|
✓
|
Compare declarations, expressions, arrows, and classes by capability, not just syntax. In particular, an arrow has no own `this` binding or `arguments` object, while a class requires `new`. section 6.2
Call site matters for `this`. A regular function receives its `this` value according to how it is called, rather than where it was written; an arrow captures `this` from its surrounding scope when created. With `new`, construction creates an object, links its prototype, calls the constructor with that object as `this`, then returns it unless the constructor returns a different object. section 6.3 section 6.7
Function behavior is specified by JavaScript; execution speed depends on the engine. V8 can pre-parse a definition and defer full parsing and bytecode generation until its first call. Repeated calls may move through Ignition, Sparkplug or Maglev, and TurboFan. Type feedback guides optimization; inconsistent inputs can invalidate assumptions and trigger deoptimization. These are V8 implementation details, not a promise that every runtime uses the same pipeline. section 6.6.1 section 6.6.2
When a function is slow, first establish that it is the source of the cost. Under load, inspect a CPU profile's bottom-up view by self-time, then check `--trace-deopt` for repeated optimization bailouts. A hot function without deoptimization or inflated garbage-collection cost may simply do expensive work; inspect the algorithm before changing its call patterns. section 11.3.2

























