JS10 Day 2: Loops

Jmnote (토론 | 기여)님의 2018년 8월 1일 (수) 19:54 판 (새 문서: ==개요== ;<nowiki>Day 2: Loops</nowiki> * https://www.hackerrank.com/challenges/js10-loops/problem <source lang='javascript'> function isVowel(ch) { if( ch == 'a' ) return true...)
(차이) ← 이전 판 | 최신판 (차이) | 다음 판 → (차이)

1 개요

Day 2: Loops
function isVowel(ch) {
    if( ch == 'a' ) return true;
    if( ch == 'e' ) return true;
    if( ch == 'i' ) return true;
    if( ch == 'o' ) return true;
    if( ch == 'u' ) return true;
    return false;
}
function vowelsAndConsonants(s) {
    for( let i=0; i<s.length; i++ ) {
        let ch = s[i];
        if( isVowel(ch) ) console.log(ch);
    }
    for( let i=0; i<s.length; i++ ) {
        let ch = s[i];
        if( !isVowel(ch) ) console.log(ch);
    }
}

2 같이 보기

문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}