diff --git a/docs/Web4university/Web2/00.InTheBeginning/js/jhwhScript.v2.js b/docs/Web4university/Web2/00.InTheBeginning/js/jhwhScript.v2.js index 695e152..688696d 100644 --- a/docs/Web4university/Web2/00.InTheBeginning/js/jhwhScript.v2.js +++ b/docs/Web4university/Web2/00.InTheBeginning/js/jhwhScript.v2.js @@ -3,12 +3,15 @@ let word = {}; // check with profiler if this makes a diffrence // add lesson how to profile with DevTools const twoPI = 2 * Math.PI +const week = 7; +let day = 0; + // DONT global variables //var globalVariable = "globalVariable"; // DONT just modify objects arbitarrily -word.j = 0.01; +word.j = 0.1; word.h = -Math.PI; // DONT misspelled creates new element // word.i = 0.01; @@ -19,25 +22,32 @@ jotaView.value = word.j; word.speak = function breath() { // DONT calculate 2 * Math.PI each time - while (word.j < 2 * Math.PI) { + while (word.h < Math.PI) { // DONT use global reference twoPI //while (word.h < twoPI) { word.h += word.j; word.w = Math.sin(word.h); - //console.log("j:", this.j); + //debugger; + console.log("h:", this.h); + + // DONT use hard coded HTML ids heightView.value = word.h; widthView.value = word.w; } - this.h = Math.PI; + word.h = -Math.PI; }; word.speak(); word.live = function eternity() { - while (this.h > 0) { + while (day++ < week) { + console.groupCollapsed("day:", day); + //debugger; + this.speak(); + console.groupEnd(); } }; word.live();