From 6bc3a145e6d84872bf2ad1dcf55d488a966164e1 Mon Sep 17 00:00:00 2001 From: Elyas Sharifi Date: Sun, 5 Jan 2025 21:03:24 +0430 Subject: [PATCH 1/2] Functions/sum --- functions/sum/exercise/index.html | 18 ++++++------ functions/sum/exercise/script.js | 46 +++++++++++++++++++++++-------- 2 files changed, 43 insertions(+), 21 deletions(-) diff --git a/functions/sum/exercise/index.html b/functions/sum/exercise/index.html index 41e979a..99a5991 100644 --- a/functions/sum/exercise/index.html +++ b/functions/sum/exercise/index.html @@ -9,14 +9,7 @@ - - - - - - - - \ No newline at end of file +
+ + + + + + + diff --git a/functions/sum/exercise/script.js b/functions/sum/exercise/script.js index 69d6b48..684cded 100644 --- a/functions/sum/exercise/script.js +++ b/functions/sum/exercise/script.js @@ -8,22 +8,44 @@ ES6 Syntax (Arrow function): const add = () => {} */ -function add(){ - //Add function here -} +// // function add(a,b){ +// // //Add function here +// // return a + b; +// // } +// console.log(add(2,2)) -function sub(){ - //Subtract function here -} +// function sub(a, b){ +// //Subtract function here +// return a - b; +// } +// console.log(sub(2,2)); -function div(){ - //Divide function here -} +// function div(a, b){ +// //Divide function here +// return a / b; +// } +// console.log(div(2,2)); -function mul(){ - //Multiply function here -} +// function mul(a, b){ +// //Multiply function here +// return a * b; +// } +// console.log(mul(2,2)); + +//ES6 Arrow functions + +const add = (a,b) => a + b; +console.log(add(2,2)); + +const sub= (a, b) => a - b; +console.log(sub(2, 2)); + +const div = (a, b) => a / b; +console.log(div(2, 2)); + +const mul = (a, b) => a * b; +console.log(mul(2, 2)) console.log('hello from the SUM exercise') /* TODO: create a function that console logs the result of any of the above operations. From eb59f618078bce52e4dc4cb27840f9b19ffd1932 Mon Sep 17 00:00:00 2001 From: Elyas Sharifi Date: Tue, 7 Jan 2025 18:18:31 +0430 Subject: [PATCH 2/2] H To S Hour to second conversion --- exercises/converthourstoseconds.js | 7 +++++++ notes/variables.js | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/exercises/converthourstoseconds.js b/exercises/converthourstoseconds.js index 99198c8..f15d33e 100644 --- a/exercises/converthourstoseconds.js +++ b/exercises/converthourstoseconds.js @@ -7,9 +7,16 @@ // it to seconds function howManySeconds(hours) { + //Ask + let result = Number(hours) + convertor = result * 60; + console.log(convertor); + //convert that hour to second + //console.log // Your function should return an integer // of how many seconds are in the hour } +howManySeconds(24); //Topics: Variables,functions, Math diff --git a/notes/variables.js b/notes/variables.js index 5b8665d..1bef17f 100644 --- a/notes/variables.js +++ b/notes/variables.js @@ -1,4 +1,4 @@ name = 'Peter Pan' console.log(name) -sentence = 'how are you doing today, nice to see you, hope you have a great day!' \ No newline at end of file +sentence = 'how are you doing today, nice to see you, hope you have a great day!'z \ No newline at end of file