Here's the JavaScript equivalent:
```javascript
// Import the random module
const random = require('random');
for (let i = 0; i < 100; i++) {
// Generate a random number between 1 and 6 (inclusive)
const roll = random.int(1, 6);
console.log("Roll", i+1, "is", roll, "\n");
}
```
Note that in JavaScript, we don't have a built-in `random` module like in Python. We can use an external library like `random-js` to achieve the same functionality. Make sure to install the `random-js` package before running the above code.
write in java script
import random
for i in range(100):
roll = random.randint(1, 6)
print("Roll", i+1, "is", roll, "\n")
1 answer