Output array value in the div

<!DOCTYPE html>
<html>
<head>
	<title></title>
	<script type="text/javascript"></script>
	<script src="https://code.jquery.com/jquery-3.5.1.js" integrity="sha256-QWo7LDvxbWT2tbbQ97B53yJnYU3WhH/C8ycbRAkjPDc=" crossorigin="anonymous"></script>
</head>
<body>
  <div id="extend" style=" width: 50px; height: 50px; border-radius: 50%; border: 2px solid #0066b2" ></div>
 <div id="extend" style=" width: 50px; height: 50px; border-radius: 50%; border: 2px solid #0066b2" ></div>
 <div id="extend" style=" width: 50px; height: 50px; border-radius: 50%; border: 2px solid #0066b2" ></div>
 <div id="extend" style=" width: 50px; height: 50px; border-radius: 50%; border: 2px solid #0066b2" ></div>
 <div id="extend" style=" width: 50px; height: 50px; border-radius: 50%; border: 2px solid #0066b2" ></div>
  <script type="text/javascript">
function shuffle (array){
  let currentIndex = array.length, temporaryValue, randomIndex;
  while (0 !== currentIndex){
    randomIndex = Math.floor (Math.random () * currentIndex);
    currentIndex -= 1;
    temporaryValue = array[currentIndex];
    array[currentIndex] = array[randomIndex];
    array[randomIndex] = temporaryValue;
  }
  return array;
}
const genArray = amount => Array(amount).fill().map((v, i) => i + 1)
let arr = genArray(60);
arr = shuffle (arr);

  var output = (arr.slice(55));
  document.getElementById("extend").innerHTML = output;
 
for (var i = 0; i < array.length; i++) {
	array[i]
}

  </script>
</body>
</html>

I’ve edited your post for readability. When you enter a code block into a forum post, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make it easier to read.

Please use the “preformatted text” tool in the editor (</>) to add backticks around text.

See this post to find the backtick on your keyboard.
Note: Backticks are not single quotes.

markdown_Forums

Welcome to the forum!

Do you have a question? You posted code with no comments or questions.

The first thing you are going to have to fix is that id attributes have to be unique for each element on a page. In other words, no two elements on the same page should have the same ID.

1 Like