-
-
Notifications
You must be signed in to change notification settings - Fork 224
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(operator): 各演算子の解説を追加 #104
Merged
Merged
Changes from 1 commit
Commits
Show all changes
34 commits
Select commit
Hold shift + click to select a range
afe0bb1
feat(operator): 草案を追加
azu 00a3b65
feat(operator): 二項演算子の解説を追加
azu 91d434f
feat(operator): グループ演算子についてを追加
azu c4866af
feat(operator): 単行プラス/マイナス演算子
azu 0ae1f46
feat(operator): 比較演算子を追加
azu 3945b70
style(operator): textlintエラーを修正
azu c5aed9a
feat(operator): 比較演算子 > < を追加
azu 6141259
feat(operator): ビット演算についてを追加
azu 1207793
style(operator): 表記を統一
azu 4e0bf28
feat(operator): ビット演算子を追加
azu 4df0dab
fix(operator): fix example
azu 8e628d9
fix(operator): fix example
azu 67d0249
fix(operator): fix example code
azu 5bb3d92
feat(operator):条件演算子を追加
azu 24eadff
feat(operator): AND、OR演算子を追加
azu 6290c7f
feat(operator):NOTと文字列結合について
azu 9c03edb
fix(operator): デフォルト引数の記述を変更
azu ad9a135
fix(operator): update power-doctest for default parameter
azu 3928d00
chore(operator): remove text
azu 4c119a8
chore(operator): 特殊な単項演算子は削除
azu b06493e
refactor(operator): +演算子の型変換についてを書き換え
azu 9f12c6d
chore(operator): グループ演算子の例を論理演算子に変更
azu dfc9188
fix(operator): ++と--についてをもっと簡潔に
azu ef94bd2
style(operator): 無駄なスペースを削除
azu 971ca1c
chore(operator): fix typo
azu 792418a
chore(operator): fix typo
azu 737d784
chore(operator): fix typo
azu bc07b77
fix(operator): 仕様が何かを明示
azu 91215a7
chore(operator): 口調の統一
azu a1a7ff5
style(operator): textlintのエラーを修正
azu 7b4df99
chore(operator): indirect callを脚注に移動
azu a0e6177
chore(operator): 評価結果を返す点についてを追加
azu 06b7c5b
chore(operator): add 。
azu efec018
chore(test): add timout option
azu File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -735,7 +735,7 @@ console.log(string.length > 0); // => false | |
|
||
グループ演算子は複数の二項演算子が組み合わさった場合に、演算子の優先順序を明示することができる演算子です。 | ||
|
||
たとえば、次のようにグループ演算子で囲んだ部分が最初に処理されるため、処理結果も変化します。 | ||
たとえば、次のようにグループ演算子で囲んだ部分が最初に処理されるため、結果も変化します。 | ||
|
||
```js | ||
var a = 1; | ||
|
@@ -746,22 +746,29 @@ a + b * c; // 7 | |
``` | ||
|
||
[演算子の優先順序][]は仕様で定義されていますが、多様な演算子が出てきた場合に見分けるのは難しいです。 | ||
そのため、グループ演算子を使い優先順序を明示することが読みやすいコードへとつながります。 | ||
グループ演算子はもっとも優先度が高い演算子となります。 | ||
そのため、グループ演算子使い優先順序を明示することが読みやすいコードへとつながります。 | ||
|
||
次のようなグループを演算子を使わずに書いたコードを見てみましょう。 | ||
`a`が`true`または、`b`かつ`c`が`true`であるときに処理されるif文になっています。 | ||
|
||
```js | ||
1 * 2 + 3 * 4; // => 14 | ||
if (a || b && c) { | ||
// a が true または | ||
// b かつ c が true | ||
} | ||
``` | ||
|
||
ひとつの式にオペランドが4つ以上出てくると読みにくくなります。 | ||
ひとつの式に複数の種類の演算子が出てくると読みにくくなる傾向があります。 | ||
このような場合にはグループ演算子を使い、結合順を明示して書くようにしましょう。 | ||
|
||
```js | ||
(1 * 2) + (3 * 4); // => 14 | ||
if (a || (b && c)) { | ||
// a が true または | ||
// b かつ c が true | ||
} | ||
``` | ||
|
||
|
||
## 文字列演算子(`+`) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 文字列演算子( There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 暗黙的な変換(次の話)への布石的なものなので後ろにあるといい感じではあるんだけど |
||
|
||
数値にでてきたプラス演算子(`+`)は、文字列の結合に利用できます。 | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
必ずしもそうではないはず
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
そうですね。
https://twitter.com/azu_re/status/759268034276159492
()をなしの例を書こうしてたのが残ってました。
(これは具体的な例に左右されそうなきがするので削除します)