Skip to content

Commit

Permalink
solution: Add solution for proxies
Browse files Browse the repository at this point in the history
Close #9
  • Loading branch information
Aurélien Allienne committed Jan 23, 2018
1 parent a1fbb80 commit 1794f70
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion exercises/proxies/exo.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
let traps = {
/* votre solution ici */
/* votre solution ici */
set: function (target, prop, value) {
if (!isNaN(prop) && !target.includes(value)) {
target.push(value.toLowerCase());
}
return true
},

get: function (target, prop) {
if (isNaN(prop)) {
return target[prop];
}
return target[prop].replace(/\W/g, '');
}
};

module.exports = {traps};

0 comments on commit 1794f70

Please sign in to comment.