Skip to content

Commit

Permalink
Refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
Gurbinder Singh committed Sep 23, 2023
1 parent 3056903 commit 28c3b64
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,19 +57,17 @@ function determineLocalStorageSize(upperBound, lowerBound) {

for (let i = 0; i < bailOut && lowerBound < upperBound; i++) {
const testBound = lowerBound + Math.ceil((upperBound - lowerBound) / 2);
const testString = createStringWithLength(testBound);


try {
const testString = createStringWithLength(testBound);
localStorage.setItem("item", testString);

lowerBound = testBound;

console.log({ lowerBound, upperBound });
} catch (error) {
// console.error(error);

upperBound = testBound - 1;
console.log({ lowerBound, upperBound });
}
console.log({ lowerBound, upperBound });
}
console.info(`Size of local storage: ${upperBound} characters`);
return lowerBound;
Expand Down

0 comments on commit 28c3b64

Please sign in to comment.