var veggies = ["Celery", "Radish", "Carrot", "Potato"];
var salad = veggies.join(" and ");
console.log(salad); // "Celery and Radish and Carrot and Potato"
练习
Use the join method to create a string from joinMe with spaces in between each element and assign it to joinedString.
代码
var joinMe = ["Split","me","into","an","array"];
var joinedString = '';
// Only change code below this line.
joinedString = joinMe.join(' ');
介绍
join
方法把数组的元素组成字符串。方法
用
and
连接数组里的元素。练习
代码
结果显示
来源
https://www.freecodecamp.org/challenges/join-strings-with-join