Skip to content

Instantly share code, notes, and snippets.

@satoyuichi
Created May 22, 2017 05:52
Show Gist options
  • Save satoyuichi/c02b44ec145ee9b327d84efbba62d9fc to your computer and use it in GitHub Desktop.
Save satoyuichi/c02b44ec145ee9b327d84efbba62d9fc to your computer and use it in GitHub Desktop.
str から 'o'(オー) の個数を数えて出力するプログラム
// str から 'o'(オー) の個数を数えて出力するプログラムを書き Gist を使って #phh_2017_yuichi チャンネルで共有しなさい
// ex) 2 個
let str = 'hogepiyopiyo';
let count = 0;
for (let elem of str) {
if (elem === 'o') {
count++;
}
}
console.log (count + ' 個');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment