Advertisement
ipsBruno

(Javascript) Pegar digito de um número

Apr 24th, 2012
325
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2. /*
  3.  *  Copyright (c) 2012 [iPs]TeaM
  4.  *  Bruno da Silva (contato@brunodasilva.com)
  5.  *  Função length number em meu pastebin
  6.  
  7.  * www.brunodasilva.com
  8.  * www.ips-team.forumeiros.com
  9. */
  10.  
  11. function getDigit(n, p) {
  12.         return p == lengthNumber(n) ? (((n / (Math.pow(10, p))) % 10) >> 0) - 1 :  (((n / (Math.pow(10, p))) % 10) >> 0);
  13. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement