javascript - What exactly are expressions that produce *side effects*? -


i have trouble understanding paragraph in page https://developer.mozilla.org/en/javascript/reference/operators/special/void:

this operator allows inserting expressions produce side effects places expression evaluates undefined desired.

what expressions produce side effects ?

a function 2 things typically: perform something , return value. functions 1 of things, both. instance function:

function square(x) {   return x * x; } 

is side-effect free since return value , invocation can replaced return value. on other hand, alert() called side-effects (alerting user) , never return value.

so void operator makes javascript ignore return value , state you're interested function's side-effects.


Comments

Popular posts from this blog

c# - SharpSVN - How to get the previous revision? -

c++ - Is it possible to compile a VST on linux? -

url - Querystring manipulation of email Address in PHP -