used forEach instead of for loop for iterating through localStorage