From 054084af4a66dae4d5e2c3fa39e84ad0bbd98c3c Mon Sep 17 00:00:00 2001 From: legogoUA Date: Tue, 30 Jan 2024 15:46:54 +0200 Subject: [PATCH] notion + solution for tasks --- HomeWork/index.html | 5 +++++ HomeWork/js/script.js | 15 +++++++++++++++ Lesson/js/script.js | 23 +++++++++++++++++++++++ 3 files changed, 43 insertions(+) diff --git a/HomeWork/index.html b/HomeWork/index.html index 56c2ca8..3bee81a 100644 --- a/HomeWork/index.html +++ b/HomeWork/index.html @@ -7,6 +7,11 @@ HomeWork4 + \ No newline at end of file diff --git a/HomeWork/js/script.js b/HomeWork/js/script.js index e69de29..634550e 100644 --- a/HomeWork/js/script.js +++ b/HomeWork/js/script.js @@ -0,0 +1,15 @@ +console.log(document); + +const addNumber = (number) => { + let sum = Number(number) + 10; + + return console.log(sum); +} + +const numberRef = document.querySelector('input[name="number"]'); + +const buttonRef = document.querySelector("button"); + +buttonRef.addEventListener("click", () => addNumber(numberRef.value)) + +console.log(numberRef.value) diff --git a/Lesson/js/script.js b/Lesson/js/script.js index e69de29..6c7b364 100644 --- a/Lesson/js/script.js +++ b/Lesson/js/script.js @@ -0,0 +1,23 @@ +// First +const checkAge = (age) => { + return ( age > 18 ) ? true : confirm('Say ok?') +} + +checkAge(24); + +// Second +const min = (a, b) => { + return (a > b) ? a : b; +} + +console.log(min(1, 4)); + +// Third +const ask = (question, yes, no) => { + return confirm(question) ? yes() : no(); +} + +const showOk = () => alert("You agree"); +const showCancel = () => alert("You disagree"); + +console.log(ask("Agree", showOk, showCancel));