How to check
if the array "games" doesn't exist or it's empty
if (!(Array.isArray(games)) || !(games.length))
return
Array.isArray(games)
determines whether "games" is an Array ( if it is Null or Undefined returns False)
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/isArray
games.length
if length of "games" is 0, condition is false because 0 is a falsy value
https://developer.mozilla.org/en-US/docs/Glossary/Falsy
Did I write anything wrong ? Or you have better ideas?
Please share it in the comments :-)