---
description: 🚧 施工中
---

# function boundary

[JS](../..) ⟩ [value](..) ⟩ [function]() ⟩ <mark style="color:purple;">**function boundary**</mark>

{% hint style="success" %}
(related to [function](../../scope/function "mention")) 🚧&#x20;
{% endhint %}

{% tabs %}
{% tab title="⭐️ 重點" %}
{% hint style="warning" %}
[break](../../grammar/statement/flow/jump/break "mention") / [continue](../../grammar/statement/flow/jump/continue "mention")&#x20;

* <mark style="color:red;">**won't**</mark> operate <mark style="color:yellow;">**across**</mark> an [iife](expr/iife "mention") <mark style="color:purple;">**function boundary**</mark> to control an <mark style="color:yellow;">**outer**</mark> [loop](../../grammar/statement/loop "mention") / [block](../../grammar/statement/other/block "mention").

📗 [You Don't Know JS Yet: Scopes & Closrues](https://github.com/getify/You-Dont-Know-JS/blob/2nd-ed/scope-closures/ch6.md#invoking-function-expressions-immediately)
{% endhint %}

{% hint style="danger" %}
if the <mark style="color:yellow;">**code**</mark> you need to <mark style="color:yellow;">**wrap**</mark> a [scope](../../scope "mention") <mark style="color:yellow;">**around**</mark> has [return](../../grammar/statement/flow/jump/return "mention") / [this](../../concept/execution-context/this "mention") / [break](../../grammar/statement/flow/jump/break "mention") / [continue](../../grammar/statement/flow/jump/continue "mention") in it：

* <mark style="color:red;">**don't**</mark>**&#x20;**<mark style="color:yellow;">**use**</mark> [](<> "mention") / [iife](expr/iife "mention") (which has <mark style="color:yellow;">**its own**</mark>**&#x20;**<mark style="color:purple;">**function boundary**</mark>):exclamation:
* <mark style="color:green;">**use**</mark> [block](../../grammar/statement/other/block "mention") instead.

📗 [You Don't Know JS Yet: Scopes & Closrues](https://github.com/getify/You-Dont-Know-JS/blob/2nd-ed/scope-closures/ch6.md#function-boundaries)
{% endhint %}
{% endtab %}

{% tab title="📗 參考" %}
* [ ] [ydkjs-scope-and-closures-v.2](../../../master/ref/book/you-dont-know-js-series-v.2/ydkjs-scope-and-closures-v.2 "mention") ⟩ Ch. 6 ⟩ [function boundaries](https://github.com/getify/You-Dont-Know-JS/blob/2nd-ed/scope-closures/ch6.md#function-boundaries)
{% endtab %}
{% endtabs %}
