SCREAMING_SNAKE_CASE coding challenge test case has a bug in it!

greetings y’all,

test case 3 check has a bug in it

toScreamingSnakeCase("user_id") should return "USER_ID" .

but in my implementation, im returning USERID an still passes!!

https://www.freecodecamp.org/learn/daily-coding-challenge/2025-12-28

thought of bringing to all of your attentoion, happy coding :slight_smile:

1 Like

Please post your code and a link to the lab instead of a picture, thanks

Thank you for helping make FCC better. Bugs can be reported as GitHub Issues. Whenever reporting a bug, please check first that there isn’t already an issue for it and provide as much detail as possible.

1 Like

here is that code cleaner version of it:

function toScreamingSnakeCase(variableName) {
  const lx = /[a-z]/
  const ux = /[A-Z]/

  let ssc = ''

  for(let c in variableName) {
    if(lx.test(variableName[c])) {
      ssc += variableName[c].toUpperCase()
    } else if (ux.test(variableName[c])) {
      ssc += (c == 0 ? '' : '_') + variableName[c]
    }
  }

  console.log(ssc, "!!", variableName)
  return ssc
}

toScreamingSnakeCase("user_id") // it passes even though it expects "USER_ID" but gets "USERID"  as a return value!!

link to lab is : https://www.freecodecamp.org/learn/daily-coding-challenge/2025-12-28

you’re right i should have included reproducible code for it earlier, thanks for bringing that up, much appreciated.

happy coding :slight_smile:

thanks for sharing that github issues direct link, i looked into it but didnt see any related test case focused issues!

seems like its a go go signal to create one then?

thanks and happy coding :slight_smile: