I have output two different arrays and it needs to check duplicates. In order to do that I want to get those two arrays in one function if possible. So the question from my side is, how should I fix that.

You need to clarify what you mean (or probably your own thinking on this subject). What do you mean ‘the two arrays are separated’? Functions don’t “have” arrays, as such - do you mean that they are local to the functions? The second function you wrote in your first post doesn’t return anything and the first one seems to (sometimes) return ‘false’.

In general, I’d say that localStorage and JSON.parse are too complicated to be using until you understand functions properly. Try writing something simpler, perhaps, to get the hang of how to call and return from functions.