function count_char(str){ count = str.length; var res = 0; for(i=0; i < count; i++){ if(str.charAt(i) == " "){ continue } res++; } return res; }