In my JavaScript code, I declared the myArr
variable in the following way:
var myArr= Array(3);
Upon logging the value of myArr
, I received the output:
[undefined × 3]
Next, I utilized the JavaScript join function with the code snippet:
myArr.join('X');
After logging the result of this operation, I obtained:
"XX"
I am puzzled by this outcome. I initially anticipated the result to be:
"undefinedXundefinedX"