DEV Community

Discussion on: Can You Guess the Result of This JavaScript Code?

Collapse
 
jahid6597 profile image
MD. JAHID HOSSAIN

yes, result will be "c".

In JavaScript, object keys are internally converted to strings. In this case, all three property keys are essentially considered as the string "1". Since the last assignment to obj["1"] is "c", that value will be printed, resulting in "c" as the output.