New answers tagged

1

what kind of tampering it might still be vulnerable to I am working on testing this locally and in the process of getting it set up so I am not sure if these things are actual areas of concern but test tampering with globals like JSON, prettyPrintError , assert, Error, etc... I tried modifying JSON.parse() and was able to change its implementation... It ...


2

The validation function: const validation = (value, min, max) => { if (value < min) { return min; } else if (value > max) { return max; } return value; }; Bounds the value between some minimum and maximum, can can be simplified to the following: const validation = (value, min, max) => Math.max(min, Math.min(value, ...


3

Style I can not fault the style and layout. The need to call init which is an indirect call to handleClick seams redundant. Do it in the constructor. I am puzzled as to why you set readonly to '' (el.setAttribute('readonly', '');) What has this to do with copying to the clipboard. Names Naming is very poor and also you use inconsistent naming conventions ...


1

Style nitpicks Be consistent with Allman vs Egyptian braces: constructor() { this.name = "name"; sd.register(this, "List:1234", "print", this.printName); } should be: constructor() { this.name = "name"; sd.register(this, "List:1234", "print", this.printName); } Use braces on all ...


2

The code does not fully comply with what is asked in the assignment and the code readability is sometimes hard. These critiques will be corrected throughout the code when we implement the fundamental idea to ... Manipulate the data, not the display Take this as a fundamental principle. Many OO design and coding buzz-word benefits naturally flow from this. ...


0

I spent a ton of time on this; The choice to replicate Date but not the other 50+ built-ins is interesting I would write isObject as const isObject = x => (typeof x === 'object' && x !== null) A question to ask yourself, what about functions, do you want to clone those as well? if (Object.keys(obj).length < 1) { return obj; } is interesting, ...


1

From a short review; Your own answer does read better map is the right approach I would go for filter instead of reduce (you only want 'true' values that are not keyword) I probably would have named total -> keys I prefer <verb><object> so combined -> addGroups If you dont use a falsy comparison, then you dont need to check for 'keyword' ...


0

I have improved it with this: const data = [ { keyword: 'banana', yellow: true, sweet: true }, { keyword: 'pineapple', yellow: true, sweet: false }, { keyword: 'apple', yellow: false, sweet: false }, ] const combined = [...data].map((entry) => { const group = Object.entries(entry).reduce((total, [key,...


Top 50 recent answers are included