Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const createCashe =()=>{
- var array =[];
- put = (a)=>{
- array.push(a);
- }
- has =(a) =>{
- if(array.indexOf(a)=='-1'){
- return false;
- }else{
- return true;
- }
- }
- return {
- put:put,
- has:has
- }
- }
- const cashe = createCashe();
- cashe.put(1);
- cashe.put(2);
- cashe.put(3);
- cashe.put(8);
- console.log(cashe.has(10));
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement