I’m trying to extend localStorage w/ the following…
localStorage.prototype.setItem2 = function(key,value) {
localStorage.setItem(key,value);
}
I’m getting “localStorage.prototype is null.” Am I doing this correctly? Thanks!
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
localStorage is an instance of the Storage object. Try
Storage.prototype.setItem2orObject.getPrototypeOf(localStorage).setItem2