+ 1

What's the value of elem variable in this code ? explain how || var elem = (1,2,3,3,4,6,5);

var elem = (1,2,3,3,4,6,5);

17th Aug 2019, 11:07 AM
Safaa Alnabhan
Safaa Alnabhan - avatar
4 Réponses
+ 4
Safaa Alnabhan The value is 5 because of your use of the comma operator. "The comma operator evaluates each of its operands (from left to right) and returns the value of the last operand." MDN https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Comma_Operator MDN, W3Schools, GeekforGeeks, TutorialsPoint are excellent programing language references and can help you gain a deeper level of understanding on your journey to becoming a master coder.
17th Aug 2019, 2:18 PM
ODLNT
ODLNT - avatar
+ 2
The value is 5 but why
17th Aug 2019, 11:59 AM
Safaa Alnabhan
Safaa Alnabhan - avatar
+ 2
You are welcome.
17th Aug 2019, 2:23 PM
ODLNT
ODLNT - avatar
+ 1
ODLNT thank you for your answer ☺
17th Aug 2019, 2:21 PM
Safaa Alnabhan
Safaa Alnabhan - avatar