Match All Letters and Numbers. Number of characters?

Tell us what’s happening:
Usually, such code logs all characters that matches.
But here it’s logged number of characters instead of characters on console.
Why…?

Your code so far


let quoteSample = "The five boxing wizards jump quickly.";
let alphabetRegexV2 = /\w/gi; // Change this line
let result = quoteSample.match(alphabetRegexV2).length;

console.log(result)


var man = "Man is vary good";
let nam = /[a]/ig;
let damn = man.match(nam);
console.log(damn);



Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.98 Safari/537.36.

Link to the challenge:
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/regular-expressions/match-all-letters-and-numbers

result is a number because of the .length on line 3.

2 Likes

oops…i am becoming a hell of ignorant these days.

It happens - try not to let it get to you. Happy coding!