Advertisement
boris-ivanov

Untitled

Mar 30th, 2019
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.40 KB | None | 0 0
  1. const createCashe =()=>{
  2. var array =[];
  3. put = (a)=>{
  4. array.push(a);
  5. }
  6. has =(a) =>{
  7. if(array.indexOf(a)=='-1'){
  8. return false;
  9. }else{
  10. return true;
  11. }
  12. }
  13. return {
  14. put:put,
  15. has:has
  16. }
  17. }
  18. const cashe = createCashe();
  19. cashe.put(1);
  20. cashe.put(2);
  21. cashe.put(3);
  22. cashe.put(8);
  23. console.log(cashe.has(10));
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement