Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Свойства функции используются для создания коллекции из функций
- var store = {
- nextId: 1,
- cache: {},
- add: function(fn) {
- if( !fn.id ) {
- fn.id = this.nextId++;
- this.cache[fn.id] = fn;
- console.log("Function was successfully added");
- return true;
- }
- console.log("This function was already added to store.");
- }
- };
- function ninja() {}
- store.add(ninja);
- store.add(ninja);
Add Comment
Please, Sign In to add comment