<!DOCTYPE html>
<html lang="en">
<head>
<title>Random Name Generator Javascript</title>
</head>
<body style="background-color: lightcyan;">
<input id="clickMe" type="button" value="Generate Random Name" onclick="generateName();" />
<h2 id="random_name"></h2>
<script>
function capFirst(string) {
return string.charAt(0).toUpperCase() + string.slice(1);
}
function getRandomInt(min, max) {
return Math.floor(Math.random() * (max - min)) + min;
}
function generateName(){
var first_name = ["abandoned","able","absolute","adorable"];
var last_name = ["people","history","way","art","world"];
var name = capFirst(first_name[getRandomInt(0, first_name.length + 1)]) + ' ' + capFirst(last_name[getRandomInt(0, last_name.length + 1)]);
document..innerHTML = name;
}
</script>
</body>
</html>