If I need to create an array from JSON.parse() and I don't know if the argument passed is undefined, I do something like this:
JSON.parse()
const myArray = JSON.parse(localStorage.getItem('items')) || [];