Skip to content

Instantly share code, notes, and snippets.

@darksh3ll
Last active March 15, 2019 06:11
Show Gist options
  • Select an option

  • Save darksh3ll/a4115ef012311522beb7f31c0902b7e1 to your computer and use it in GitHub Desktop.

Select an option

Save darksh3ll/a4115ef012311522beb7f31c0902b7e1 to your computer and use it in GitHub Desktop.
cherche voyelle
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`;
}
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))
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