Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- "use strict";
- var $ = function (id) { return document.getElementById(id); };
- var Coins ={
- cents: 0,
- IsValid: function (){
- var cents = $("cents").value;
- return (!isNaN(this.cents)|| this.cents > 0 || this.cents < 99) ? true :alert( "Enter a valid value");},
- /*if(isNaN(this.cents) || this.cents < 0 || this.cents > 99 ){
- alert ("Please enter a number between 0 and 99");
- return false;
- }
- else{
- return true;}
- },*/
- getNumber: function (divisor){
- var coins = Math.floor(this.cents/this.divisor);
- this.cents = this.cents % this.divisor;
- return coins;
- }
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement