function e(){
return 4, false;
}
e()
// e () -> false
function f() {
return 4 + 4, true;
}
f()
// f() -> true
Shouldn't I expect it to return 4 or sum of 4 + 4. Why every time my function e()
and function f()
return 2nd value?
function e(){
return 4, false;
}
e()
// e () -> false
function f() {
return 4 + 4, true;
}
f()
// f() -> true
Shouldn't I expect it to return 4 or sum of 4 + 4. Why every time my function e()
and function f()
return 2nd value?
For further actions, you may consider blocking this person and/or reporting abuse
angular-freelancer.de -
Yago Souza Oliveira -
Alexey Timin -
Jimmy Guerrero -
Top comments (5)
developer.mozilla.org/en-US/docs/W...
Thank you. I actually got confused on left to right and right to left evaluate thing.
return only returns 1 value, and it vould be the last,
if you like to return more then 1 value you can do this as a array
function e() {
return [4,false];
}
if you then like to get first part just type
e()[0];
thank you it was really helpful. I saw this code in react, they had this long complex return with , so I thought what the use of it?
what's the desired behavior of these functions?