+1

Plz help

When I run this code it comes with an error. https://www.sololearn.com/post/174757/?ref=app

11/13/2019 7:34:32 AM

Shreyansh

7 Answers

New Answer

+11

Try using : document.getElementById("img"); [Assuming you have an image with an id value img].

+10

Tru using this : var x=Math.floor(Math.random()*i); Math.random() is used only to get random values between 0 and 1 like 0.4562737 or 0.818717 which when multiplied by any value of i will be 0. So you can floor down the result which gives you the exact number.

+9

My pleasure 😊👍

+3

Nova thanks it worked I was using square brackets

+3

Nova plz help This code works fine when I output any specific image but I want to generate random images

+2

Nova thanks bro I had been trying this for last few days

+1

Nova I've tried Here is the link of code https://code.sololearn.com/Wn0mu628JD1d/?ref=app