• + 1 comment
    // 1
    
    // function vowelsAndConsonants(s) {
    //     const vowels = 'aeiou';
    
    //     for (let index = 0; index < s.length; index++) {
    //         if (vowels.includes(s[index])) {
    //             console.log(s[index]);
    //         }
    //     }
    
    //     for (let index = 0; index < s.length; index++) {
    //         if (!vowels.includes(s[index])) {
    //             console.log(s[index]);
    //         }
    //     }
    // }
    
    
    // 2
    
    // function vowelsAndConsonants(s) {
    //     const vowels = 'aeiou';
    
    //     // output vowels
    //     for (let i = 0; i < s.length; i++) {
    //         if (vowels.indexOf(s.charAt(i)) > -1) {
    //             console.log(s.charAt(i));
    //         }
    //     }
    
    //     // output consonants
    //     for (let i = 0; i < s.length; i++) {
    //         if (vowels.indexOf(s.charAt(i)) < 0) {
    //             console.log(s.charAt(i));
    //         }
    //     }
    // }
    
    // 3 
    
    // function vowelsAndConsonants(s) {
    //     const vowels = 'aeiou';
    //     s = s.split(''); 
    
    //     // output vowels
    //     s.forEach((i) => {
    //         if (vowels.indexOf(i) > -1) {
    //             console.log(i);
    //         }
    //         return i;
    //     });
    
    //     // output consonants
    //     s.forEach((i) => {
    //         if (vowels.indexOf(i) < 0) {
    //             console.log(i);
    //         }
    //         return i;
    //     });
    // }
    
    // 4
    
    // function vowelsAndConsonants(s) {
    //     let vowels = ["a", "e", "i", "o", "u"];
    
    //     for (let v of s) {
    //         if (vowels.includes(v)) {
    //             console.log(v);
    //         }
    //     }
    
    //     for (let v of s) {
    //         if (!vowels.includes(v)) {
    //             console.log(v);
    //         }
    //     }
    // }
    
    // 5 My Solution
    
    function vowelsAndConsonants(s) {
        let vowels = ['a', 'e', 'i', 'o', 'u'];
    
        for (let i = 0; i < s.length; i++) {
            if (vowels.includes(s[i])) {
                console.log(s[i]);
            }
        }
    
        for (let i = 0; i < s.length; i++) {
            if (!vowels.includes(s[i])) {
                console.log(s[i]);
            }
        }
    }