如何仅使用 客户端JavaScript从GitHub托管的数据库(JSON文件,CSV等)中随机选择一个值?
非常感谢
编辑:示例数据和访问代码
abap channels for event signaling
abap unified connectivity
abdominal exercise apparatus
abdominal fluid management apparatus
ablation catheter
ablation needle guide
ablation stretcher
able stack assembly
(这是原始数据,以换行符分隔。目前,我将其转换为javascript数组,如下所示)
var data =
[
"abap channels for event signaling",
"abap unified connectivity",
"abdominal exercise apparatus",
"abdominal fluid management apparatus",
"ablation catheter",
"ablation needle guide",
"ablation stretcher",
"able stack assembly",
...
// Select a random idea
var idea = data[Math.floor(Math.random() * (Object.keys(data).length))];