• + 0 comments

    This was my solution. I turned it into an array and then used a forEach which probably wasn't the best for what I was doing as I've still not figured out when it's better to use a for vs forEach,

    function vowelsAndConsonants(s) {
        const stringArray = s.split("");
        
        stringArray.forEach((letter)=>{        
            if(/[aeiou]/.test(letter)){
                console.log(letter)
            }
        })
        stringArray.forEach((letter)=>{        
            if(!/[aeiou]/.test(letter)){
                console.log(letter)
            }
        }
        )
    }