Json in js
我做了一个js程序,从1—50 Select 一个"advice number". 它需要一种连接json文件的方法.
Js file:个
Advice_number = Math.floor(Math.random() * 50 ) + 1
console.log(Advice_number)
function Advice_picker() {
}
Json file:
[
"When in the backrooms, keep your eyes low, for the walls have ears and the floors have eyes.",
"Beware the flickering lights, for they are whispers of entities unseen.",
"Navigate the endless halls with caution, for each turn may lead to another layer of despair.",
"In the backrooms, silence is your ally. Speak softly, lest you awaken something that slumbers.",
"Find solace in the quiet corners, but never linger for too long, for the stillness may consume you.",
"Mark your path with care, for the backrooms shift and twist, leading even the most vigilant astray.",
"Trust not the echoes, for they may lead you deeper into the labyrinth, where escape is but a fleeting dream.",
"When all seems lost, seek the flicker of a distant light. But beware, for not all beacons lead to salvation.",
]
...
I have more in the json file个
我试着寻找内置函数,但没有找到任何. 我的目标是,它 Select 的数字,它记录一个 * 随机 * advice.
如果你知道任何功能,这将有助于你,请告诉我.