What is the defference between /gi and /ig in regular expression?

i solved a challenge with /ig and it said that i was wrong and when i looked at the solution, it was solved with /gi

Technically, there is no difference. Not sure which challenge you were solving, but it could be the way the tests “check” your code and expected the “g” to come before the “i”. If you provide the challenge url, I can check for you.