I have a function which I have written which basically looks like this:
function getNextCard(searchTerms) {
// Setup Some Variables
// Do a bunch of log
I think it is very debatable what to use. I prefer code that is semantically as accurate as possible, so I think undefined is appropriate in this case.
I think of null assignments as meaning "a variable set to nothing". This is as opposed to undefined meaning "this thing isn't there at all"
As a previous answer pointed out, returning undefined has issues, and it's completely up to you whether that bothers you. It wouldn't bother me.