Skip to content

Commit

Permalink
added DONTS
Browse files Browse the repository at this point in the history
  • Loading branch information
mdonges authored Nov 5, 2023
1 parent 7caf77b commit f27f436
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 5 deletions.
13 changes: 9 additions & 4 deletions docs/Web4university/Web2/00.InTheBeginning/js/jhwhScript.v2.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,23 @@
let word = {};

// check with profiler if this makes a diffrence
// add lesson how to profile with DevTools
const twoPI = 2 * Math.PI
//var globalVariable = "globalVariable";

// DONT global variables
//var globalVariable = "globalVariable";

// DONT just modify objects arbitarrily
word.j = 0.01;
word.h = -Math.PI;
// DONT misspelled creates new element
// word.i = 0.01;

// DONT use hard code HTML-tag IDs
jotaView.value = word.j;


word.speak = function breath() {


// DONT calculate 2 * Math.PI each time
while (word.j < 2 * Math.PI) {
// DONT use global reference twoPI
Expand All @@ -23,7 +28,7 @@ word.speak = function breath() {
//console.log("j:", this.j);

// DONT use hard coded HTML ids
heightView.value = word.h;
jotaView.value = word.h;
heightView.value = word.h;
widthView.value = word.w;
}
Expand Down
12 changes: 11 additions & 1 deletion docs/Web4university/Web2/00.InTheBeginning/static/index.v2.htm
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,17 @@ <h1>Hello my Friend!</h1>
<!--
<div class="center-bold">Drag and Drop Component to Load</div>
-->
<script src="../js/jhwhScript.js" type="text/javascript"></script>
<!-- DONT load scripts in the body
load in the head...but only start on onLoad event
load in the head but start after page is rendered (in onLoad event)
load later not functions but classes
start classes after loading
Here we do it like that because if
<input id="widthView" type="number" value="0">
is not yet rendered, the script can not access it.
-->
<script src="../js/jhwhScript.v2.js" type="text/javascript"></script>
</body>

</html>

0 comments on commit f27f436

Please sign in to comment.