Write a code that will print how many times a vowel is present in a particular string and also print the index of where it's found.
const text = "This is a simple text";
const pattern = /[aeiou]/g;
let output = "";
while((result = pattern.exec(text)) !== null) {
output += result[0] + " " + pattern.lastIndex + "\n";
}
console.log(output);
/* output
i 3
i 6
a 9
i 12
e 16
e 19
*/