我遇到了一个关于数组列表的问题,我想要在数组列表中返回一个随机的名字,但是我在实现时遇到了问题。
``function randomName(names) { names = ["john", "Ben", "Jenny", "Michael", "Chloe"]; Math.random(names.length); console.log(names); return names + "is going to buy lunch today!"; } randomName();
我希望输出结果是:
Michael (or any name in the array) is going to buy lunch today!
能指导我如何实现这个吗?