diff --git a/AMD_example.html b/AMD_example.html new file mode 100644 index 0000000..8adbed8 --- /dev/null +++ b/AMD_example.html @@ -0,0 +1,12 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/ES6-examples.html b/ES6-examples.html new file mode 100644 index 0000000..aeccb8d --- /dev/null +++ b/ES6-examples.html @@ -0,0 +1,188 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/arrow_examples.html b/arrow_examples.html new file mode 100644 index 0000000..45e7ae7 --- /dev/null +++ b/arrow_examples.html @@ -0,0 +1,19 @@ + + + + + + + + +
+ +
+ + \ No newline at end of file diff --git a/class_example.html b/class_example.html new file mode 100644 index 0000000..6946e49 --- /dev/null +++ b/class_example.html @@ -0,0 +1,43 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/inheritance_example.html b/inheritance_example.html new file mode 100644 index 0000000..0fb5aea --- /dev/null +++ b/inheritance_example.html @@ -0,0 +1,90 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/let_example.html b/let_example.html new file mode 100644 index 0000000..f834b61 --- /dev/null +++ b/let_example.html @@ -0,0 +1,31 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/lexical_this_example.html b/lexical_this_example.html new file mode 100644 index 0000000..e879efc --- /dev/null +++ b/lexical_this_example.html @@ -0,0 +1,37 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/lib.js b/lib.js new file mode 100644 index 0000000..c7d4444 --- /dev/null +++ b/lib.js @@ -0,0 +1,13 @@ +//------ lib.js ------ +var sqrt = Math.sqrt; +function square(x) { + return x * x; +} +function diag(x, y) { + return sqrt(square(x) + square(y)); +} +module.exports = { + sqrt: sqrt, + square: square, + diag: diag, +}; \ No newline at end of file diff --git a/lib_es6.js b/lib_es6.js new file mode 100644 index 0000000..6ad2cf5 --- /dev/null +++ b/lib_es6.js @@ -0,0 +1,8 @@ +//------ lib.js ------ +export const sqrt = Math.sqrt; +export function square(x) { + return x * x; +} +export function diag(x, y) { + return sqrt(square(x) + square(y)); +} \ No newline at end of file diff --git a/main.js b/main.js new file mode 100644 index 0000000..6285467 --- /dev/null +++ b/main.js @@ -0,0 +1,5 @@ +//------ main.js ------ +var square = require('./lib').square; +var diag = require('./lib').diag; +console.log("Square of 11 is " + square(11)); // 121 +console.log("Diagonal of 4 and 3 is " + diag(4, 3)); // 5 \ No newline at end of file diff --git a/main_es6.js b/main_es6.js new file mode 100644 index 0000000..1fbefd7 --- /dev/null +++ b/main_es6.js @@ -0,0 +1,3 @@ +import { square, diag } from 'lib_es6'; +alert("ES6 way - square of 11 is "+ square(11)); // 121 +alert("ES6 way - diagonal of 4 and 3 is "+ diag(4, 3)); // 5 \ No newline at end of file diff --git a/module_example.html b/module_example.html new file mode 100644 index 0000000..cce2867 --- /dev/null +++ b/module_example.html @@ -0,0 +1,13 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/promise_example.html b/promise_example.html new file mode 100644 index 0000000..2e96c4c --- /dev/null +++ b/promise_example.html @@ -0,0 +1,69 @@ + + + + + + + + + + + \ No newline at end of file