Learn Basic String and Array Methods by Building a Music Player - Step 18

Hello,

I believe there is a typo in the join() method example:

const exampleArr = [“This”, “is”, “a”, “sentence”];
const sentence = exampleArray.join(" "); // Separator takes a space character
console.log(sentence); // Output: “This is a sentence”

I expect:
const sentence = exampleArray.join(" “);
should actually be:
const sentence = exampleArr.join(” ");

I looked into becoming a volunteer to fix it without needing to post here, but got overwhelmed at the setup as I am still learning(on step 18 today lol).

I’m not 100% sure that I’m right, but I’m pretty sure.

Hello:)
It works like this: Array.prototype.join() - JavaScript | MDN (mozilla.org)

example:

const a = ["Wind", "Water", "Fire"];
a.join(); // 'Wind,Water,Fire'
a.join(", "); // 'Wind, Water, Fire'
a.join(" + "); // 'Wind + Water + Fire'
a.join(""); // 'WindWaterFire'
1 Like

you are right!
would you like to at least open a github issue for it?

1 Like

Thanks for giving me the link to that option! I just submitted the issue there.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.