Vue

by Roland Doda

HTML

<div id="exercise">
		<div><button class="test" v-on:click="newCheck()">New Challenge</button>
    <p >Success check is: {{ passCheck }}</p>
    <!-- 3) Call a function to output a random float between 0 and 1 (Math.random()) -->
		</div>
		<div>
		<button class="roll" v-on:click="roll20()">Roll!</button>
    <p>You Rolled a {{ yourRoll }}</p>
		</div>
</div>

Vue

new Vue({
		el: '#exercise',
		data: {
			yourRoll: '10',
			passCheck: '10',	
		},
		methods: {
			roll20: function(){
				this.yourRoll = Math.round(Math.random()*19)+1;
			},
			newCheck: function(){
				this.passCheck = Math.round(Math.random()*19)+1;
			}
		}
	});