var z = 0; class Ufo { constructor() { this.x = 5; this.y = 2; let z = 8; z++; this.GOC = { b: "Hallo", funx: function(d) { this.a=13; this.b="ballo"; alert("GOC:b= "+ this.b+" :: d="+d+" :: z="+z++); return z; } }; } alpha() { alert("alpha"); this.x = 6; } } function DO(name) { this.c = 888; this.x= 88; x= 20; if (name=='D') this.x=10; else if (name=='E') this.x=11; else if (name=='F') this.x=12; else this.x=99999; alert("name = " + name); alert("this.x = " + this.x + " :: x=" + x); this.ay = ['x', 13, 14, 15]; this.name = name; } DO.prototype.makex = function(x) { var z = x; this.x = z; return z; } DO.prototype.show = function(varia) { return this[varia]; } DO.prototype.b = 'Tarja'; function closuretest(str, x) { var i = 1000; return function () { alert("closure :: str = "+str+"; x (closure) = "+x+ " :: i(closure) = " + i++);} } var y = "super"; var D = new DO("D"); var E = new DO("E"); U = new Ufo(); U.s = 'sieben'; B=new Ufo(); B.b = function(){ return 9;}; var V = Object.create(U); V.alpha(); alert("V.s = "+V.s); console.log(Object.getPrototypeOf(V)); D['s']=5; alert("D.x="+D.x); D['x']='str13'; alert("D.x="+D.x); D.b='Marja'; alert("E.b= "+E.b); function K() {}; K.prototype= U; K.prototype.pfn = function(i) {alert("new method! i="+i)}; L=new K(); alert("L.s = " + L.s + ":: L.y = "+L.y); L.pfn(1); U.pfn(2); U.s='sechs'; K.s = 'acht'; LL = new K(); alert("U.s = "+U.s+" :: L.s="+L.s +":: LL.s="+LL.s); LL.s=9; alert("U.s = "+U.s+" :: L.s="+L.s +":: LL.s="+LL.s +" :: K.s="+K.s); L.ufo=-2; var W = new Ufo(); alert("W.s="+W.s); var F = new DO("F"); alert("F.x = "+F.x); var t = (function () {alert("start 0"); return "we have started!"; }()); var tt = (function ft(){ z=45; return z+10; })(); alert("t = " + t + " :: tt = " + tt + " :: z = " + z); E.s = closuretest('hallo!', x); E.x = closuretest('hallo!', x); E.s(); alert("nochmal "); E.e = E.show('s'); E.e(); alert("nochmal "); E.e(); alert("nochmal "); E.x = E.show('s'); E.x(); E.makex(11); alert("E.x = " + E.x); fux = function() { return W.GOC.funx('ich'); }; U.fx = function(callback) {x = 999; alert("U.fx: x = " +x); return callback(); }; Z = new Ufo(); alert(" has Z fx() ? :: " + Z.hasOwnProperty('fx')); alert(" has Z prop s ? :: " + Z.hasOwnProperty('s')); fun = ( function duper(w=1) { alert("start 1" + " :: w = " + w); z = 100 + w; t = 1; return { ff: function() { t = [1,2]; x = 200 - w; }}; }(17)); W. x = z; U.fx(fux); fun.ff(); alert("z = " + z + " :: x = " + x + ":: t = " + t ); tux = function() { return W.GOC.funx('du'); }; D.hilfe = function(Obj){ return function(){alert( Obj + " I help you!");} }; D.help = D.hilfe('D:'); D.help(); alert("D.s = " + D.s + " :: x = " + x ); alert("F.s = " + F.s + " :: F has property s = " + F.hasOwnProperty('s') ) ; console.log("F.s = "+F.show('s')+" :: F.c = "+F.show('c')+":"+F.hasOwnProperty('c') ); E.hilf = D.hilfe('E:'); E.hilf(); D.x=['1','2']; z = V.fx(tux); alert("z = " + z); z = L.fx(fux); alert("z = " + z); function DOChild(name) { DO.apply(this, arguments); } DOChild.prototype = new DO(); var CH = new DOChild('du'); console.log("CHs name = " + CH.show('name')); alert("CH.s = "+CH.s +" :: CH.b ="+CH.b); W.pfn(); CH.hilfe(); Z.fx(tux); E.hilfe('K:'); LL.b(); schrott=ft();