Tier 7 · Apprenticereplace
Snake To Kebab
Turn snake_case into kebab-case: user_first_name becomes user-first-name.
Replace mode runs input.replace(pattern, replacement) and compares the result. The pattern here is a single literal character — the whole difficulty is the g flag. Without it, replace stops after the first hit and you get user-first_name. This is the first thing to check whenever a replace "half works".
Your pattern0 chars · par 3
//
Flags
Start typing — tests run as you go.0 of 4 visible tests passing
Test cases
user_first_name→ "user-first-name"two underscores — both must go
created_at→ "created-at"a_b→ "a-b"id→ "id"nothing to do
+ 4 hidden tests, checked when you submit. They are what stops a pattern that only fits the examples above.