diff --git a/js/filterLongWords.js b/js/filterLongWords.js index e69de29..a242af8 100644 --- a/js/filterLongWords.js +++ b/js/filterLongWords.js @@ -0,0 +1,14 @@ +var arrayOfWords = ["test", "hello", "you", "abcdef"]; +var maxLength = 4; +var newArray = []; + +function arrayPusher (arrayOfWords) { + for (var i = 0; i < arrayOfWords.length; i++) { + if (arrayOfWords[i].length < maxLength) { + newArray.push(arrayOfWords[i]); + } + } + console.log(newArray); +} + +arrayPusher(arrayOfWords); diff --git a/js/fizzbuzz.js b/js/fizzbuzz.js index e69de29..0aa2558 100644 --- a/js/fizzbuzz.js +++ b/js/fizzbuzz.js @@ -0,0 +1,14 @@ +for (i = 0; i < 100; i++ ) { + if (i % 3 === 0 && i % 5 === 0) { + console.log("FizzBuzz"); + } + else if (i % 3 === 0) { + console.log("Fizz"); + } + else if ( i % 5 === 0) { + console.log("Buzz"); + } + else { + console.log(i); + } +} \ No newline at end of file diff --git a/js/grade.js b/js/grade.js index e69de29..e00b55b 100644 --- a/js/grade.js +++ b/js/grade.js @@ -0,0 +1,21 @@ +var grade = 70; + +switch(parseInt(grade / 10)) { + case 10: + console.log("A"); + break; + case 9: + console.log("A"); + break; + case 8: + console.log("B"); + break; + case 7: + console.log("C"); + break; + case 6: + console.log("D") + break; + default: + console.log("F") +} \ No newline at end of file diff --git a/js/index.html b/js/index.html new file mode 100644 index 0000000..ec23131 --- /dev/null +++ b/js/index.html @@ -0,0 +1,9 @@ + + +
+