Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

find vowel & consonants in a string java script

const str = "The quick brown fox jumps over a lazy dog"; 
const vowels = str.match(/[aeiou]/gi); 
const consonants = str.match(/[^aeiou]/gi);   
vowels.concat([''],consonants).forEach(k => { console.log(k); } );
Comment

vowel check in javascript

// check the word is vowel or not
let words = "aeiou";

let newWords = "";

function isVowelOrNot(words) {
   for (let word of words) {
      if (
         word === "a" ||
         word === "e" ||
         word === "i" ||
         word === "o" ||
         word === "u"
      ) {
         newWords = newWords + word;
      }
   }
   if (newWords === words) {
      return true;
   } else {
      return false;
   }
}

let result = isVowelOrNot(words);
console.log(result);
Comment

is vowel javascript

const encode = (string) => {
  let newStringArray =string.split("").filter(
    (ch) => ch === "a" || ch === "e" || ch === "i" || ch === "o" || ch === "u"
  );
  return newStringArray;
};

encode('football').forEach(vowel=>{
  console.log(vowel);
})
//o
//o
//a
Comment

PREVIOUS NEXT
Code Example
Javascript :: hide a div when user clicks outside of it 
Javascript :: get last item in array 
Javascript :: javascript pass all arguments to another function 
Javascript :: getusermedia example 
Javascript :: usereducer hook react 
Javascript :: save text to file nodejs 
Javascript :: eas build apk 
Javascript :: javascript merge two objects 
Javascript :: getting href value in jquery 
Javascript :: js get option value 
Javascript :: conditional object spread 
Javascript :: javascript subtract 2 dates get difference in minutes 
Javascript :: array remove index from array 
Javascript :: replace data in files in node.js 
Javascript :: lodash deep compare two objects 
Javascript :: string to html 
Javascript :: Tribonacci Sequence in JavaScript 
Javascript :: compose es6 
Javascript :: regex for email 
Javascript :: default input type date limit date js 
Javascript :: extract urls from string javascript 
Javascript :: js bundle with popper bootstrap 
Javascript :: how to edit website 
Javascript :: js regex with variable 
Javascript :: javascript lowercase string except first letter of every word if there are ' 
Javascript :: android force date inside RecyclerView to re render 
Javascript :: react to string 
Javascript :: javascript cookie expire in 5 minutes 
Javascript :: Program for factorial of a number in javascript 
Javascript :: btn.addeventlistener 
ADD CONTENT
Topic
Content
Source link
Name
3+2 =