Voodlewoodlel (not about codecadamy)


#1


i want to make a little program called Voodlewoodlel. So what i need to do is that i replace every vowel in string with 'oodle'
Example:
sinistra

output:
soodlenoodlestroodle


function changeVowels() {
    var user = prompt('Please enter your string below!');
    var vowels = ['a', 'e', 'i', 'o', 'u'];
    for(i=0;i<user.length;i++) {
        for(j=0;j<vowels.length;j++) {
            if(user[i] === vowels[j]) {
                user[i] = user[i].replace(i, "oodle");
            }
        }
    }
    console.log(user);
}
changeVowels();


#2

this line:

user[i] = user[i].replace(i, "oodle");

you want to replace from users string, and you want to replace from a specific spot in user string so then you get:

x = user.replace(user[i], "oodle");

and you should store the result in a different variable, otherwise all the vowels in oodle will be replaced as well


#3

@stetim94 Will you please show me how you store result in different variable


#4

i did? i stored the result in a new variable named x?


#5

@stetim94 so how should the code look?


#6

i posted the code:


#7

nevem mind i repaired my code my self and now it works!! :slight_smile:


#8

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.