I'm solving this problem on one of the coding platform and I wonder if given answer is correct. Please refer to the code below:
What is the output of the following code?
var color= ["Orange", "Blue", "Green"];
color.push("Red");
console.log(color[0]+ " " +color[color.length-1]);
I think output for this code should be Orange Green as "Red" will join the array and color.length-1 will return green as the output but the correct answer given is ** "Orange Red**". What is logic behind this?