Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.javascript > #32470 > unrolled thread
| Started by | "Evertjan." <exxjxw.hannivoort@inter.nl.net> |
|---|---|
| First post | 2017-02-05 10:39 +0100 |
| Last post | 2017-02-05 10:39 +0100 |
| Articles | 1 — 1 participant |
Back to article view | Back to comp.lang.javascript
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: Values of statements "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2017-02-05 10:39 +0100
| From | "Evertjan." <exxjxw.hannivoort@inter.nl.net> |
|---|---|
| Date | 2017-02-05 10:39 +0100 |
| Subject | Re: Values of statements |
| Message-ID | <XnsA7136C6DE3F79eejj99@194.109.6.166> |
ram@zedat.fu-berlin.de (Stefan Ram) wrote on 05 Feb 2017 in
comp.lang.javascript:
> In JavaScript, statements have values.
No, that's too bold a statement!
There is a difference between functions and statements.
Even functions do not 'have' a value, but 'return' a value.
Statements do NOT return a value,
EXCEPT when a function is used as a statement, as
then it returns a value that is immediately discarded.
alert('hi'); // Statement, no return vanue.
let z = add(2,3); // function [user defined here]
add(2,3); // same function now used as a statement
let z = alert('hi'); // returns 'undefined', for lack of returning a value
alert(z);
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Back to top | Article view | comp.lang.javascript
csiph-web