diff --git a/js/filterLongWords.js b/js/filterLongWords.js index e69de29..0d3ed6e 100644 --- a/js/filterLongWords.js +++ b/js/filterLongWords.js @@ -0,0 +1,17 @@ + +var maxLength = 4 +var filterLongWords = function (array){ + var longWordArray =[] + array.forEach(function(x){ + if (x.length<=maxLength){ + }else{ + longWordArray.push(x); + array.pop(x); + console.log("As some words exceeded maxLength of "+maxLength+",those words have been pushed to a new array") + console.log("original array: "+array) + console.log("new array: "+longWordArray) + console.log("maximum character length is: "+maxLength) + } + }) + +} \ No newline at end of file diff --git a/js/fizzbuzz.js b/js/fizzbuzz.js index e69de29..aeaf256 100644 --- a/js/fizzbuzz.js +++ b/js/fizzbuzz.js @@ -0,0 +1,15 @@ +var fizzBuzz = function() { + for (num=1;num<101;num++){ + if (num%3==0&&num%5==0){ + console.log("fizzBuzz"); + }else if(num%3==0){ + console.log("fizz"); + }else if(num%5==0){ + console.log("buzz"); + }else{ + console.log(num); + } + } +} + +fizzBuzz(); \ No newline at end of file diff --git a/js/grade.js b/js/grade.js index e69de29..0096d26 100644 --- a/js/grade.js +++ b/js/grade.js @@ -0,0 +1,12 @@ +var grade = function(score){ + switch(true){ + case score>80&&score<=100: + console.log("A"); + break; + case score<=80&&score>50: + console.log("Pass"); + break; + default: + console.log("Fail"); + } +} \ 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 @@ + + +
+