Notifications
Clear all

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

1 Posts
1 Users
0 Likes
164 Views
(@whellerrashad)
Posts: 729
Noble Member
Topic starter
 

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. const retrieveFromLocalStorage = (storageKey) =>{ return window.localStorage[storageKey];
    }

Show Answer Hide Answer

Suggested Answer: C
 
Posted : 05/02/2023 12:34 pm

Latest Salesforce JavaScript Developer I Dumps Valid Version

Latest And Valid Q&A | Instant Download | Once Fail, Full Refund
Share: