Javascript examples for Data Type:Number
get only number from value
<html> <head></head> <body> <script> var tel = "(123)123-2432"; var getLength = function(tel){ var telStr = tel.split(''); var excpetionList = ['(',')','-']; return telStr.filter(function(item,index,arr){ if(excpetionList.indexOf(item) < 0){ return item;/*from w ww . j a va2s. c o m*/ } }).join('').length; }; console.log(getLength(tel)); </script> </body> </html>