Advertisement
monaliza86

Untitled

Feb 13th, 2019
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. "use strict";
  2. var $ = function (id) { return document.getElementById(id); };
  3.  
  4.   var Coins ={
  5.  
  6.  
  7.     cents: 0,
  8.      IsValid: function (){
  9.          var cents = $("cents").value;
  10.        
  11.     return (!isNaN(this.cents)|| this.cents > 0 || this.cents < 99) ? true :alert( "Enter a valid value");},
  12.        
  13.     /*if(isNaN(this.cents) || this.cents < 0 || this.cents > 99 ){
  14.        
  15.         alert ("Please enter a number between 0 and 99");
  16.         return false;
  17.        
  18.         }
  19.    
  20.         else{
  21.             return true;}
  22.        
  23.     },*/
  24.        
  25.     getNumber: function (divisor){
  26.        
  27.         var coins = Math.floor(this.cents/this.divisor);
  28.         this.cents = this.cents % this.divisor;
  29.        
  30.         return coins;
  31.        
  32.     }
  33. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement