개발공부/Error

[자바스크립트] Uncaught TypeError: Cannot read properties of undefined (reading ' ')

pringspring 2022. 4. 29. 01:13

 

*원인

  1. 변수의 값이 없는 것

*해결

  1. var users=JSON.parse(localStorage.getItem("users") || "[]"); --->이렇게 작성함 ..
  2. 변수 선언 전에 저장함