---
description: a statement that evaluates to a value.
---

# expression

[JS](../..) ⟩ [statement]() ⟩ expression

{% hint style="success" %}
([](<> "mention")) A fragment of code that <mark style="color:yellow;">**produces**</mark> a [val](../../val "mention").
{% endhint %}

{% tabs %}
{% tab title="🔴 主題" %}
* [op](../op "mention")
* [primary](expr/primary "mention")
  * [obj](../../val/obj/create/obj "mention") <mark style="color:yellow;">**/**</mark> [arr](../../val/builtin/arr/create/arr "mention")
  * [expr](../../val/func/expr "mention")
  * [invoke](expr/invoke "mention") <mark style="color:yellow;">- calls a function.</mark>
* [lhs](expr/lhs "mention")
  * [property-access-expression](../../val/obj/prop/access/property-access-expression "mention")
{% endtab %}

{% tab title="⭐️ 重點" %}
{% hint style="info" %}
<mark style="color:yellow;">**two types of**</mark>**&#x20;**<mark style="color:purple;">**expressions**</mark>

* those that have <mark style="color:orange;">**side effects**</mark> (such as assigning values)&#x20;
* those that <mark style="color:yellow;">**purely evaluate**</mark>.
{% endhint %}

{% hint style="info" %}
you can use an [expr](expr "mention") to refer to an object's [prop](../../val/obj/prop "mention")<mark style="color:yellow;">.</mark>&#x20;

👉 [bracket-notation](../../val/obj/prop/access/bracket-notation "mention")
{% endhint %}
{% endtab %}

{% tab title="📗 參考" %}
* [ ] (2020) JavaScript The Definitive Guide, 1.3 A Tour of JavaScript
* [ ] [javascript-the-definitive-guide](../../../master/ref/javascript-the-definitive-guide "mention") ⟩&#x20;
  * [ ] 1.3 A Tour of JavaScript
  * [ ] Ch. 4：Expressions & Operators
* [ ] [Expressions versus statements in JavaScript](https://2ality.com/2012/09/expressions-vs-statements.html) ⭐️
* [ ] [Javascript 的表達式 (Expressions) 和陳述式 (Statements)：一個用說的，一個用做的](https://medium.com/itsems-frontend/javascript-expressions-and-statements-7bd374effc95)
{% endtab %}

{% tab title="📘 手冊" %}
* [ ] [Expressions and operators](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators)
{% endtab %}
{% endtabs %}
