0160デフォルトの名無しさん
2019/02/17(日) 03:04:30.74ID:lVDDSVXkWeb制作板JavaScript質問スレにて、
https://en.wikipedia.org/wiki/Side_effect_(computer_science)
の以下の文章について…
> One common demonstration of side effect behavior is that of the assignment operator in C++.
副作用の振る舞いの一般的なデモとしては、C++の代入演算子があります。
> For example, assignment returns the right operand and has the side effect of assigning that value to a variable.
例えば代入は右オペランドを返し、かつそれと同じ値を変数に代入するという副作用を持ちます。
スレ民の叡智を結集した結果、
・C++の代入演算子は副作用があるが、JavaScriptの代入演算子は副作用がない
・[1,2,3].map(v => (v += 2, v * v));
のv += 2は主作用を使っているのであって、副作用など使っていない!
と決定しました!
パチパチパチ〜
ありがとー!!