mercredi 14 novembre 2018

JavaScript Math.random() not working in Apache Tomcat/7.0.56

I have a JavaScript on a webpage wherein it has a code:

Math.floor(Math.random() * 100)

But it is not running, i.e., it is not generating a random number. I tried to check it via an alert this way:

alert('${Math.random() * 100}');

but it is showing "0" as the output. This Webpage is hosted on Apache Tomcat/7.0.56 server.

While this JavaScript is running fine on Apache Server.

I want to know: how we can make this random function work and is there are some alternatives to it?




Aucun commentaire:

Enregistrer un commentaire