View Single Post
Old 11-12-2012, 03:24 PM   PM User | #1
triko
New Coder

 
Join Date: Oct 2012
Location: Italy
Posts: 72
Thanks: 3
Thanked 0 Times in 0 Posts
triko is an unknown quantity at this point
Function into IF. Don't work

HI all!
I have this code, but when I running, the program ignore the function vocals and it run without remove the vocals!!! Can you fund my error?
Thanks All
Code:
            function vocals ()
            {
                var v;
                v = "a" + "e" + "i" + "o" + "u";
            }
            
            function calculateName(name)
            {
               
                var myName = "";
                var countConsonants = 0;
                for (var i = 0; i < name.length; i++)
                {
// after here was: if ( (name[i] != "a") && (name[i] != "e") && (name[i] != "i")  && (name[i] != "o") && (name[i] != "u") 

/*And now that is*/ if ( name[i] != vocals ) 
                    {
                        myName = myName + name[i];
                        myName = myName.substring (0,3);
                        countConsonants ++;
                    }
                }
triko is offline   Reply With Quote