gpt4 book ai didi

reason - 加入字符串数组?

转载 作者:行者123 更新时间:2023-12-04 13:30:30 27 4
gpt4 key购买 nike

在 JavaScript 中,你可以加入一个字符串数组,例如:

fruits = ["orange", "apple", "banana"];
joined = fruits.join(", ");

console.log(joined)

// "orange, apple, banana"

你如何在 ReasonML 中做到这一点?

最佳答案

您可以使用 Js.Array.joinWith :

let fruits = [|"orange", "apple", "banana"|];
let joined = Js.Array.joinWith(", ", fruits);
Js.log(joined);
// "orange, apple, banana"

关于reason - 加入字符串数组?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49944067/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com