In JavaScript, when objects are used as keys in another object, they are implicitly converted to strings. So, b.toString() would return "[object Object]", and c.toString() would also return "[object Object]". Result, both b and c would be treated as the same key like "[object Object]". when used to access a. Therefore, the value of a[b] is 111 and the value of a[c] is 222.would be the last assigned value, which is 222 So the answer is 222
@ArpithaIndira2 ай бұрын
Thank you 🙏 😊
@akbees2355 ай бұрын
Error in assignment Properties of object cannot be access or assign using square brackets but periods(.)
@raj.blazers6 ай бұрын
That’s y we ask you to shift to typescript to avoid writing crazy code like this😎
@deepdas76746 ай бұрын
222
@Vijayvijay-s8g8j6 ай бұрын
Const variable cannot be re-sign
@SaiKumar-tg6ct6 ай бұрын
Here, variable is not reassigned, learn about primitive and referenced data types
@710krutanlakeshri56 ай бұрын
It is an object so it can be altered
@chunckyfreshnut6 ай бұрын
First thing who would actually write code like this and for what.
@avdsuresh6 ай бұрын
The interviewer will ask these kinds of questions to get know candidates logical thinking and problem solving skills