Random text insert

by DOK_UA

HTML

<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8">
         <title>Свойство display в CSS3</title>

    </head>
    <body>
        <div>Это <span id = "stroka">строчный</span> элемент span</div>
        <div>Это <span class="blockSpan">блочный</span> элемент span</div>
        <input type="button" id="btnReand" value="randomize"><br>
    </body>
</html>

CSS

span{color: green;
     font-family: arial;
     font-weight:bold
     
    }
.blockSpan{display: block;}

JavaScript

var wordArray = [
"alex",
"alex2",
"alex3",
"alex4",
"alex5",
"alex6",
"alex7"]

function getRandomInt(max) {
  return Math.floor(Math.random() * Math.floor(max));
}

$("#btnReand").click(function(){
var randomText = getRandomInt(wordArray.length);
$("#stroka").text(wordArray[randomText]);
});