Advertisement
Guest User

Untitled

a guest
Mar 19th, 2019
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.33 KB | None | 0 0
  1. function findByQuery(query) {
  2. let i, results = [];
  3. for (i in window.localStorage) {
  4. if (window.localStorage.hasOwnProperty(i)) {
  5. if (i.match(query) || (!query && typeof i === 'string')) {
  6. results.push(i);
  7. }
  8. }
  9. }
  10. return results;
  11. }
  12.  
  13. console.log(findByQuery('test'));
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement