Advertisement
Guest User

10. Digit Checker

a guest
Jul 23rd, 2014
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function checkDigit(value) {
  2.     value = value.toString();
  3.     if (value.charAt(value.length - 3) === '3') {
  4.         return true;
  5.     }
  6.     else {
  7.         return false;
  8.     }
  9. }
  10.  
  11.  
  12. console.log(checkDigit(1235));
  13. console.log(checkDigit(25368));
  14. console.log(checkDigit(123456));
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement