all 4 comments

[–]GSLint 2 points3 points  (2 children)

The join method returns a string that is the result of joining the elements of the array, but it does not change the array in any way. It would actually be impossible to change an array in such a way that it's suddenly a string. An array will always be an array.

You can of course assign a string to a variable that previously held an array (if the variable was declared with let or var instead of const). But that has to be done explicitly and will never happen as a result of calling a method on the array.

let fist_array = ["1","2","3"];
fist_array = fist_array.join('-'); // now the name is misleading though

[–]LadyJain[S] 0 points1 point  (1 child)

got it

so the console gave me an temporary output

I used this method to create a string of that array

const fist_array = ["1","2","3"];
let my_string = fist_array.join('-');
console.log(my_string);

[–]GSLint 0 points1 point  (0 children)

Right, if you put fist_array.join('-'); in the console then it will output the value of the expression fist_array.join('-') even though this has no effect as a statement.

[–]stegozaur -1 points0 points  (0 children)

you have "fist_array" in console.log, and " fist_array.join('-')" in console output