Last active
March 15, 2019 06:11
-
-
Save darksh3ll/a4115ef012311522beb7f31c0902b7e1 to your computer and use it in GitHub Desktop.
cherche voyelle
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const getCount = (str) => { | |
| let consonne = 0 | |
| let vowelsCount = 0; | |
| const letter = str.split('') | |
| let voyelles = ["a", "o", "i", "e", "u"]; | |
| letter.map((letter) => { | |
| voyelles.includes(letter) ? vowelsCount += 1 : consonne+=1 | |
| }) | |
| return `${vowelsCount} voyelles et ${consonne} consone`; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const str = 'coucou comment ca vas toi depuis le temps' | |
| const getCount = (str) => { | |
| let consonne = 0 | |
| let vowelsCount = 0; | |
| const letter = str.split('') | |
| let voyelles = ["a", "o", "i", "e", "u"]; | |
| letter.map((letter) => { | |
| voyelles.includes(letter) ? vowelsCount += 1 : consonne+=1 | |
| }) | |
| return `${vowelsCount} voyelles et ${consonne} consone`; | |
| } | |
| console.log(getCount(str)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function getCount(str) { | |
| let vowelsCount = 0; | |
| let voyelles = ["a","o","i","e","u"]; | |
| for ( let i = 0; i < str.length; i++ ) { | |
| if (voyelles.includes(str[i]) === true) { | |
| vowelsCount += str[i].length | |
| } | |
| } | |
| return vowelsCount; | |
| } | |
| console.log(getCount("")); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment