1.

For clearing all the settings which function should be called?(a) localStorage.remove(key)(b) localStorage.clear()(c) localStorage.remove()(d) localStorage.clearAll()I had been asked this question by my college professor while I was bunking the class.This intriguing question comes from Web Storage topic in portion HTML Markup, Forms, Video, Audio & Other Multimedia of HTML

Answer»

The correct choice is (b) localStorage.clear()

To explain: If we want to delete all the setting we can call localStorage.clear() method, localStorage.remove(key) only REMOVES the key of the value that we have GIVEN. Same can be APPLIED with sessionStorage ALSO the syntax will be sessionStorage.clear().



Discussion

No Comment Found

Related InterviewSolutions