I'm working with this code. Now, just for checking, I printed typeof arr and it displayed "object" in the console. Although, I declared arr as an array in the beginning. Has it been converted to an object? Here's the code:
<script>
function getDomainsOfEmails(text) {
var arr=new Array;
var regex= /[a-z0-9._%+-]+@[a-z0-9.-]+\.[a-z]{2,4}/g;
var matches= text.match(regex);
for(var i=0; i<matches.length; i++){
arr[i]=matches[i].match(/@[a-z0-9.-]+\.[a-z]{2,4}/);
}
for(j=0; j<arr.length; j++){
console.log(arr[j]);
}
console.log(typeof arr);
}
getDomainsOfEmails("[email protected] is not a mail? Is [email protected] ? No? google.com? [email protected] gmail.com");
</script>
Also, I would like to know if it's an object, what are its properties and values?