如何将数组的值显示为逗号分隔值
How to display value of array to comma separated values
31: (2) ["https://localhost:44375/api/Image/2388", "https://localhost:44375/api/Image/2388"]
我得到了这样的价值,但我想像这样显示它,
https://localhost:44375/api/Image/2388, https://localhost:44375/api/Image/2388
我怎样才能做到这一点?
您可以使用array#join
The join() method creates and returns a new string by concatenating all of the elements in an array (or an array-like object), separated by commas or a specified separator string.
const data = ["https://localhost:44375/api/Image/2388", "https://localhost:44375/api/Image/2388"],
result = data.join(', ');
console.log(result);
31: (2) ["https://localhost:44375/api/Image/2388", "https://localhost:44375/api/Image/2388"]
我得到了这样的价值,但我想像这样显示它,
https://localhost:44375/api/Image/2388, https://localhost:44375/api/Image/2388
我怎样才能做到这一点?
您可以使用array#join
The join() method creates and returns a new string by concatenating all of the elements in an array (or an array-like object), separated by commas or a specified separator string.
const data = ["https://localhost:44375/api/Image/2388", "https://localhost:44375/api/Image/2388"],
result = data.join(', ');
console.log(result);