48. function Mixin( data ) {
return function( target ){
Object.assign( target.prototype, data );
};
}
@Mixin({
bar: "bar"
})
class Foo {
}
let foo = new Foo();
console.log( foo.bar );
49. function Readonly( target, key, descriptor )
{
descriptor.writable = false;
return descriptor;
}
class Foo{
@Readonly
bar(){
}
}
let foo = new Foo();
foo.bar ="bar"; // ERROR
50.
51. function test(){
let arr = Array.from( arguments );
Array.isArray( arr ); // true
arr.includes( 2 ); // true
arr.find( n => n === 2 ); // 2
}
test( 1, 2, 3 );
let foo = { foo: "foo" };
Object.assign( foo, { bar: "bar" } );
foo; // { foo: "foo", bar: "bar" }