Сделать так, чтобы заработало console.log(object.a === 3) //true delete object.a; console.log(object.a === 1) //true ========================= Сделать так, чтобы object.myMethod() // Hey, I am in a parent // Hey, I am in a child Typescript аналог class A { public myMethod() { console.log('Hey, I am in a parent'); } } class B extends A { public myMethod() { super.myMethod(); console.log('Hey, I am in a child'); } } ========================= Реализовать функцию toBooleanArray, которая каждый элемент массива преобразовывает к соответствующему логическому значению [1,0,-1, [0]].toBooleanArray(); //[true, false, true, true] ========================= Реализовать Dependency Injection var multiplicator = { invoke: function() { return this.a * this.b; } } var divider = { invoke: function() { return this.a / this.b; } } var obj = new MyInjectable(3, 2, multiplicator); var anotherObj = new MyInjectable(10, 5, divider); console.log(obj.doCommand()); //6 console.log(anotherObj.doCommand()); //2 ========================= Написать Monkey Patch для getPrivate и getPublic var module = (function() { var private = 1; return { public: 2, getPrivate: function() { return private; }, getPublic: function() { return this.public; } } })(); //Magic module.getPrivate(); //Private value is unreachable; //Result of calculations is 1 //1 module.getPublic(); //Public value is 2 //Result of calculations is 2 //2 ========================== function FeedbackBox(elem, options) { this.options = options; this.element = elem; this.isOpen = false; } FeedbackBox.prototype.toggleError = function(obj, isError) { if(isError) { obj.class = "error"; } else { obj.class = "OK"; } }; var obj = new FeedbackBox({}, {prop: 'noErrors'}); const object = {}; obj.toggleError(object, true); console.log(obj.options.prop) //noErrors MAGIC obj.toggleError(object, true); console.log(obj.options.prop) //hasError