+ 6
First look at Tibor Santa's correction note, <b> should be an object if we want to access its member by member-access operator (dot) Output can only be 151 when <c> was declared as string, rather than an array. [ "199" ] [ 0 ] yields "199", the first array element "199" [ 0 ] yields "1" the first character (Edit) [ "199" ] [ 0 ] [ 0 ] also yields the first character from the first array element You might be questioning the correctness of the code now that you see this ...
17th Dec 2022, 2:16 PM
Ipang
+ 6
Syntax error. Your variable b is invalid. If you fix it to be a javascript object (change to curly braces): let b = {x: 4, y: 10}.y; Then the result is: 5 + 10 + "199" = 15199
17th Dec 2022, 11:07 AM
Tibor Santa
Tibor Santa - avatar
+ 3
Sony Hossain You can always see the output of any code by running it. That's what Code Playground is for.
17th Dec 2022, 1:10 PM
Emerson Prado
Emerson Prado - avatar
+ 2
Sony Hossain I see. Get used to be specific in the questions. When you need to understand how the code works, ask that. Don't leave that for the readers guesses. Ah, always include a tag with the language name.
17th Dec 2022, 2:36 PM
Emerson Prado
Emerson Prado - avatar