I'm trying to get a random number each time someone clicks a button. The range of the numbers is from one(1) to five(5). If this question has already been asked and answered, please point me to the question and I'll delete this one to avoid duplication.
HTML
<div id="content"></div>
<button id="add">Add Object</button>
JS
$(document).ready(function(){
var Player = {
name: "One",
weapon: Sword = {
damage: 1 + Math.floor(Math.random() * 5),
speed: 10
}
}
var player_damage = Player.weapon.damage;
$("#add").on("click", function(){
$("#content").append(player_damage + " ");
})
})