JSFiddle - React, Tailwind, and code Playground

by michaeldausmann

JavaScript

var input = 'this is a string with vowels, consonants and punctuation.'
var vCount = input.match(/[aeiou]/g).length;
var cCount = input.match(/[bcdfghjklmnpqrstvwxyz]/g).length;
var out = {vowels: vCount, consonants: cCount};
console.log(JSON.stringify(out));