Hello everyone, I am just wondering why does my code console logs the same array twice?
Your code so far
let quoteSample = "Blueberry 3.141592653s are delicious.";
let myRegex = /[h-s2-6]/ig; // Change this line
let result = quoteSample.match(myRegex); // Change this line
console.log(result);
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.125 Safari/537.36.
Challenge: Match Numbers and Letters of the Alphabet
I think that hat to do with the number of clicks on the run button:
When you finish the code only 1 array is shown.
2 clicks -----> 2 arrays
3 clicks -----> 3 arrays and so on.
I assume it is due to the results that maybe will not be cleared (removed) after every code execution.
An other thing! If you don’t use the console.log() your code also will be executed and submitted without any ‘trouble’ with those not removed results (arrays)!