JSFiddle - React, Tailwind, and code Playground

by Jessie Lau

HTML

Assignment: Random Array
Create an array X and fill the array with 10 values, each value being a random integer between 0 to 100.  For example when your program is done, X could be something like this: [35, 15, 3, 39, 53, 93, 25, 39, 59, 21].

JavaScript

function randomArray(n){
  var x = [];
  for(var i = 0; i < n; i++){
    x.push(Math.floor(Math.random()*100 + 0));  
  }
  return x;
}
console.log(randomArray(10));