我想做一个简单的JavaScript函数,它需要一个字符串作为输入。例如,如果我的“地方”数组中的元素,“房子”,“农场”,“粮仓”,“酒店”,我输入字符串:如何使用字符串内的数组元素打印多个句子?
Hello, welcome to my $place. I hope you like it here at my $place.
输出会是这样:
Hello, welcome to my house. I hope you like it here at my house.
Hello, welcome to my farm. I hope you like it here at my farm.
Hello, welcome to my barn. I hope you like it here at my barn.
Hello, welcome to my hotel. I hope you like it here at my hotel.
哪里是你的代码写的地图吗?究竟是不是在工作呢? – csmckelvey