Emmanuil 4 years ago
parent
commit
0be45aae7b
2 changed files with 59 additions and 0 deletions
  1. 12 0
      js-08/index.html
  2. 47 0
      js-08/js.js

+ 12 - 0
js-08/index.html

@@ -0,0 +1,12 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+    <meta charset="UTF-8">
+    <meta name="viewport" content="width=device-width, initial-scale=1.0">
+    <title>Document</title>
+</head>
+<body>
+    
+    <script src="js.js"></script>
+</body>
+</html>

+ 47 - 0
js-08/js.js

@@ -0,0 +1,47 @@
+// makeProfileTimer
+// function makeProfileTimer() {
+//   var t1 = performance.now();
+//   return function () {
+//     var t2 = performance.now();
+//     console.log(t2 - t1);
+//   };
+// }
+// var timer = makeProfileTimer();
+// timer()
+
+// makeSaver
+// makeSaver = (fn) => {
+//   var x = fn();
+//   return (_) => x;
+// };
+
+// var saver = makeSaver(Math.random);
+// var value1 = saver();
+// var value2 = saver();
+// value1 === value2;
+
+// var saver2 = makeSaver(
+//   () =>
+//     console.log("saved function called") ||
+//     [null, undefined, false, "", 0, Math.random()][Math.ceil(Math.random() * 6)]
+// );
+// var value3 = saver2();
+// var value4 = saver2();
+
+// value3 === value4;
+
+// Final Countdown
+// var obj = 6;
+// function timer() {
+//   obj--;
+//   if (obj == 0) {
+//     console.log("поехали!");
+//     obj.delete(0)
+//   } else {
+//     setTimeout(timer, 1000);
+//   }
+//   console.log(obj)
+// }
+// setTimeout(timer, 1000);
+
+