diff --git a/about_scope.js b/about_scope.js new file mode 100644 index 00000000..efa802a0 --- /dev/null +++ b/about_scope.js @@ -0,0 +1,21 @@ +module("About Scope (topics/about_scope.js)"); + +thisIsAGlobalVariable = 77; + +test("global variables", function() { + equal(__, thisIsAGlobalVariable, 'is thisIsAGlobalVariable defined in this scope?'); +}); + +test("variables declared inside of a function", function() { + var outerVariable = "outer"; + + // this is a self-invoking function. Notice that it calls itself at the end (). + (function() { + var innerVariable = "inner"; + equal(__, outerVariable, 'is outerVariable defined in this scope?'); + equal(__, innerVariable, 'is innerVariable defined in this scope?'); + })(); + + equal(__, outerVariable, 'is outerVariable defined in this scope?'); + equal(__, typeof(innerVariable), 'is innerVariable defined in this scope?'); +}); diff --git a/data/images/dom.js b/data/images/dom.js new file mode 100644 index 00000000..96edf2c3 --- /dev/null +++ b/data/images/dom.js @@ -0,0 +1,4 @@ +let parent = document.getElementById("list"); + +let clone = parent.cloneChild(true); +console.log(clone);