나는 때라도을 가지고있다로컬 스토리지 및 배열과 자바 스크립트 객체 저장 문제
patientDiseasesStorage = new Object()
patientDiseasesStorage['p158246547'] = [1, 3, 8, 2, 5] //and many more of this with different p-number
나는이 객체/배열 조합
localStorage.setItem('patientDiseasesStorage', JSON.stringify(patientDiseasesStorage));
을 저장 지금하려고하지만 난이 다시 읽으려고 할 때 localStorage에서 올바른 값을 가지고 있지 않습니다.
patientDiseasesStorage = JSON.parse(localStorage.getItem('patientDiseasesStorage'));
patientDiseasesStorage['p158246547'] is now undefined and not the array.
내가 뭘 잘못하고 있니?
실제로'p158246547'는 변수입니까? 그렇다면 두 경우 모두 같은 값입니까? – pimvdb
나는이 ID를 많이 가지고있다. 그리고 그 ID에 대한 배열을 저장하고 나중에 같은 ID의 – Brainiac
을 가진 로컬 스토리지에서 배열을 가져 오려고합니다. 그러나 실제 ID는'p158246547' 변수에 저장되어 있습니까? 아니면 ID 자체가'p158246547'입니까? – pimvdb