Which code statement correctly retrieves and returns an object from localStorage?

Which code statement correctly retrieves and returns an object from localStorage?
A . const retrieveFromLocalStorage = () =>{return JSON.stringify(window.localStorage.getItem(storageKey));}
B . const retrieveFromLocalStorage = (storageKey) =>{return window.localStorage.getItem(storageKey);}
C . const retrieveFromLocalStorage = (storageKey) =>{return JSON.parse(window.localStorage.getItem(storageKey));}
D . constretrieveFromLocalStorage = (storageKey) =>{return window.localStorage[storageKey];}

Answer: C

Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments