How many different languages can you do that in, in 20 seconds, without looking it up?
Personally, I think I can only do it in Python and C off the top of my head without looking. I'd have to look up how to do it, idiomatically, in C++, Rust, Go, Perl, PHP, and Javascript.
I'm not going to memorize random functions off the top of my head and I'm not going to waste brainspace on something I can use chatgpt really quickly and move on with others tasks more specific to my domain.
I'd rather focus and use energy on business logic + the part that are more specific to my domain than generic functions I can ask chatgpt and come back in a little bit.
It's like trying to bake a pizza and having to think how to grow tomatoes.
If ChatGPT can free you up from thinking about the basics, you can channel your energy into some more advanced concepts.