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));