well-balanced

[Hackerrank JavaScript] Loop 본문

JavaScript

[Hackerrank JavaScript] Loop

Cosmian 2019. 12. 22. 02:47

Problem

[

Day 2: Loops | HackerRank

Learn For, While and Do-While loops in Javascript.

www.hackerrank.com

](https://www.hackerrank.com/challenges/js10-loops/problem)

function vowelsAndConsonants(s) {
    const vowels = ['a','e','i','o','u']
    for (var i of s) {
        if(vowels.includes(i)){
            console.log(i)
        }
    }
    for (i of s) {
        if(!vowels.includes(i)){
            console.log(i)
        }
    }
}

vowelsAndConsonants('javascriptloops')
Comments