感谢您阅读此问题。
让foodArray = [" pasta"," cheese"," banana"," water"]
让expectOutput ="意大利面;奶酪;香蕉;水"
将foodArray转换为expectedOutput会有什么好方法?
谢谢。
答案 0 :(得分:1)
let foodArray = ["pasta", "cheese", "banana", "water"]
let expectedOutput = "pasta;cheese;banana;water"
let actualOutput = join(";", foodArray)
let worked = expectedOutput == actualOutput
worked
是true
。