let str = '<span class="my"> <var suv="inn">';
let regexp = /<(([a-z]+)\s*([^>]*))>/g;
let result = str.matchAll(regexp);
console.log(result[0]);
console.log(result);
//It is an iterable object'
console.log("Array from method");
var a = Array.from(result);
console.log(a[0]);
console.log(a[1]);
console.log("for loop method");
for (let value of result){
console.log(value);
}
we can see that when we place the ArrayFrom method first, it logged the values but ForLoop method didn't.
let str = '<span class="my"> <var suv="inn">';
let regexp = /<(([a-z]+)\s*([^>]*))>/g;
let result = str.matchAll(regexp);
console.log(result[0]);
console.log(result);
//It is an iterable object'
console.log("for loop method");
for (let value of result){
console.log(value);
}
console.log("Array from method");
var a = Array.from(result);
console.log(a[0]);
console.log(a[1]);
and similarly when we place the ForLoop method first, it logged the values but ArraFrom method didn't.
Why is not both methods logging after one method logs.
(I really didn't know how else to frame my question, I really hope I'm clear!)