나는 이와 같은 객체의 동작을 수정하는 데 매우주의를 기울일 것입니다. 일반적으로 LocalStorage에 래퍼를 제공하는 것이 좋습니다 (또는 사용 Store.js 또는 다른 라이브러리) 원하는 기능을 제공합니다.
당신이 하다 LocalStorage에 메소드 나 속성을 추가하려면 생성자의 프로토 타입에 추가하여 그렇게 할 수 있습니다.
typeof(localStorage.prototype); // "undefined"
localStorage.constructor // function Storage() { [native code] }
Storage.prototype.foo = function () { return 'foo'; }
// setting a method on the constructor allows each localStorage instance
// to inherit and use it
localstorage.foo() // 'foo'