From 45d14427425578f28d9fc9356f318ba75400a89b Mon Sep 17 00:00:00 2001 From: Smig Tech Date: Tue, 19 Sep 2023 12:35:49 -0400 Subject: [PATCH] javascript basics from the course --- javascript/index.html | 11 +++++++++ javascript/script.js | 53 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 64 insertions(+) create mode 100644 javascript/index.html create mode 100644 javascript/script.js diff --git a/javascript/index.html b/javascript/index.html new file mode 100644 index 0000000..a9f675b --- /dev/null +++ b/javascript/index.html @@ -0,0 +1,11 @@ + + + + + + Document + + + + + \ No newline at end of file diff --git a/javascript/script.js b/javascript/script.js new file mode 100644 index 0000000..416565f --- /dev/null +++ b/javascript/script.js @@ -0,0 +1,53 @@ +let add7 = (number) => { + sum = number + 7; + console.log(sum); +} + +add7(2); + + +function multiply(x, y) { + console.log(x * y); +} + +multiply(5,5); + +let capitalize = (word) => { + // if (word != String) { + // console.log("Need a string") + // } + str_len = word.length + console.log(word[0].toUpperCase()+word.slice(1,str_len)) + +} + +let test = testing => { + console.log(testing) +} + +let lastLetter = word => { console.log(word[word.length - 1])} + +capitalize("bob") +capitalize("UPPER") +capitalize("tHiS Is Mixed") +test("Hello, there!") + +lastLetter("DeeZ") + + +let fizzBuss = number => { + if (number % 5 == 0 && number % 3 == 0) { + console.log("FizzBuzz") + } else if (number % 3 == 0) { + console.log("Fizz") + } else if (number % 5 == 0) { + console.log("Buzz") + } +} + + +fizzBuss(10) +fizzBuss(15) +fizzBuss(9) +fizzBuss(4) +fizzBuss(900) \ No newline at end of file