Non-urgent post: regex, /C+/ or /C/?

solution gives /C+/ but /C/ looks better to me
Describe your issue in detail here.

Your code so far

let q='P1P5P4CCCcP2P6P3'
let reCriminals = /C+/g; // Change this line
let r=q.match(reCriminals)
console.log(r.length)

CONSOLE LOG:
1
let q='P1P5P4CCCcP2P6P3'

let reCriminals = /C/g; // Change this line

let r=q.match(reCriminals)

console.log(r.length)

CONSOLE LOG :
3

Your browser information:

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

Challenge: Find One or More Criminals in a Hunt

Link to the challenge:

i suppose it wants a single string output.
never mind, no big deal. i just find the concept of some excercises annoying. criminals? is this the staying close together concept?

if you think it needs a different description you can open an issue on github, GitHub - freeCodeCamp/freeCodeCamp: freeCodeCamp.org's open-source codebase and curriculum. Learn to c
The freeCodeCamp team is always open to feedback

1 Like

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.