Hola, primera vez aquí y soy muy nuevo en la codificación.
Estoy creando un sitio web donde es una especie de broma interna sobre nfts (burlarse de ellos solo quería ser claro)
y obtuve un montón de imágenes generadas al azar de las que quiero que me seleccionen para mostrar una al azar cuando haces clic en un botón
ahora mismo tengo esto
<script type="text/javascript"> ImageArray = new Array(); ImageArray[0] = "https://cdn.discordapp.com/attachments/669350505264447512/912516499862863892/55.png"; ImageArray[1] = 'https://cdn.discordapp.com/attachments/669350505264447512/912516499531522128/52.png'; ImageArray[2] = 'https://cdn.discordapp.com/attachments/669350505264447512/912516499208548432/54.png'; ImageArray[3] = 'https://cdn.discordapp.com/attachments/669350505264447512/912516498898173962/32.png'; ImageArray[4] = 'https://cdn.discordapp.com/attachments/669350505264447512/912516498617171988/44.png'; ImageArray[5] = 'https://cdn.discordapp.com/attachments/669350505264447512/912516498390659082/47.png'; ImageArray[6] = 'https://cdn.discordapp.com/attachments/669350505264447512/912516498138988554/27.png'; ImageArray[7] = 'https://cdn.discordapp.com/attachments/669350505264447512/912516497883152414/11.png'; ImageArray[8] = 'https://cdn.discordapp.com/attachments/669350505264447512/912516497686036520/5.png'; ImageArray[9] = 'https://cdn.discordapp.com/attachments/669350505264447512/912516497459535882/3.png'; ImageArray[10] = 'https://cdn.discordapp.com/attachments/669350505264447512/912517257987518484/70.png'; function getRandomImage() { var num = Math.floor( Math.random() * 11); var img = ImageArray[num]; document.getElementById("randImage").innerHTML = ('<img src="' + img + '" width="300px,">') } </script> <button onclick="getRandomImage()";>NFT</button> <div class="parent" id="randImage" ></div>"y eso funciona bastante bien, pero no quiero escribir ImageArray 1 a 100 para cada imagen posible y me preguntaba si de alguna manera podría escribirlo donde se extrae de un archivo de todas las imágenes.
Se agradecería la ayuda y también explicar tanto como sea posible porque me gustaría saber cómo hacer cosas similares.
https://misinformedmember.000webhostapp.com/
arriba está el sitio web si ayuda