From 40ab9cb914ea28d1ec160a0376cd010b921c7d3f Mon Sep 17 00:00:00 2001 From: murphyjmac Date: Sat, 11 Apr 2015 14:41:49 -0400 Subject: [PATCH] I'm done javascripting --- javascripting/accessing-array-values.js | 2 ++ javascripting/array-filtering.js | 6 ++++++ javascripting/arrays.js | 3 +++ javascripting/for-loop.js | 8 ++++++++ javascripting/function-arguments.js | 5 +++++ javascripting/functions.js | 5 +++++ javascripting/if-statement.js | 6 ++++++ javascripting/introduction.js | 1 + javascripting/looping-through-arrays.js | 6 ++++++ javascripting/number-to-string.js | 2 ++ javascripting/numbers.js | 2 ++ javascripting/object-properties.js | 5 +++++ javascripting/objects.js | 7 +++++++ javascripting/revising-strings.js | 2 ++ javascripting/rounding-numbers.js | 3 +++ javascripting/string-length.js | 2 ++ javascripting/strings.js | 2 ++ javascripting/variables.js | 2 ++ 18 files changed, 69 insertions(+) create mode 100644 javascripting/accessing-array-values.js create mode 100644 javascripting/array-filtering.js create mode 100644 javascripting/arrays.js create mode 100644 javascripting/for-loop.js create mode 100644 javascripting/function-arguments.js create mode 100644 javascripting/functions.js create mode 100644 javascripting/if-statement.js create mode 100644 javascripting/introduction.js create mode 100644 javascripting/looping-through-arrays.js create mode 100644 javascripting/number-to-string.js create mode 100644 javascripting/numbers.js create mode 100644 javascripting/object-properties.js create mode 100644 javascripting/objects.js create mode 100644 javascripting/revising-strings.js create mode 100644 javascripting/rounding-numbers.js create mode 100644 javascripting/string-length.js create mode 100644 javascripting/strings.js create mode 100644 javascripting/variables.js diff --git a/javascripting/accessing-array-values.js b/javascripting/accessing-array-values.js new file mode 100644 index 0000000..b1875d6 --- /dev/null +++ b/javascripting/accessing-array-values.js @@ -0,0 +1,2 @@ +var food = ['apple', 'pizza', 'pear']; +console.log(food[1]); \ No newline at end of file diff --git a/javascripting/array-filtering.js b/javascripting/array-filtering.js new file mode 100644 index 0000000..084134b --- /dev/null +++ b/javascripting/array-filtering.js @@ -0,0 +1,6 @@ +var numbers = [1,2,3,4,5,6,7,8,9,10]; +var filtered = numbers.filter(function evenNumbers(number){ + return number % 2 === 0; +}); + +console.log(filtered); \ No newline at end of file diff --git a/javascripting/arrays.js b/javascripting/arrays.js new file mode 100644 index 0000000..421f265 --- /dev/null +++ b/javascripting/arrays.js @@ -0,0 +1,3 @@ +var pizzaToppings = ['tomato sauce', 'cheese', 'pepperoni']; + +console.log(pizzaToppings); \ No newline at end of file diff --git a/javascripting/for-loop.js b/javascripting/for-loop.js new file mode 100644 index 0000000..b63da6f --- /dev/null +++ b/javascripting/for-loop.js @@ -0,0 +1,8 @@ +var total = 0; +var limit = 10; + +for(var i = total; i < limit; i++){ + total += i; +} + +console.log(total); \ No newline at end of file diff --git a/javascripting/function-arguments.js b/javascripting/function-arguments.js new file mode 100644 index 0000000..226ccd1 --- /dev/null +++ b/javascripting/function-arguments.js @@ -0,0 +1,5 @@ +function math(a,b,c){ + return b * c + a; +} + +console.log(math(53, 61, 67)); \ No newline at end of file diff --git a/javascripting/functions.js b/javascripting/functions.js new file mode 100644 index 0000000..9623018 --- /dev/null +++ b/javascripting/functions.js @@ -0,0 +1,5 @@ +function eat (food) { + return food + ' tasted really good.'; +} + +console.log(eat('bananas')); \ No newline at end of file diff --git a/javascripting/if-statement.js b/javascripting/if-statement.js new file mode 100644 index 0000000..af48c3d --- /dev/null +++ b/javascripting/if-statement.js @@ -0,0 +1,6 @@ +var fruit = 'orange'; +if(fruit.length > 5){ + console.log("The fruit name has more than five characters."); +}else { + console.log("The fruit name has five characters or less."); +} diff --git a/javascripting/introduction.js b/javascripting/introduction.js new file mode 100644 index 0000000..ea17b22 --- /dev/null +++ b/javascripting/introduction.js @@ -0,0 +1 @@ +console.log('hello'); \ No newline at end of file diff --git a/javascripting/looping-through-arrays.js b/javascripting/looping-through-arrays.js new file mode 100644 index 0000000..25eb6ab --- /dev/null +++ b/javascripting/looping-through-arrays.js @@ -0,0 +1,6 @@ +var pets =['cat', 'dog', 'rat']; +for(var i = 0; i < pets.length; i++){ + pets[i] = pets[i] + 's'; +} + +console.log(pets); \ No newline at end of file diff --git a/javascripting/number-to-string.js b/javascripting/number-to-string.js new file mode 100644 index 0000000..39cbd6b --- /dev/null +++ b/javascripting/number-to-string.js @@ -0,0 +1,2 @@ +var n = 128; +console.log(n.toString()); \ No newline at end of file diff --git a/javascripting/numbers.js b/javascripting/numbers.js new file mode 100644 index 0000000..a3b77b5 --- /dev/null +++ b/javascripting/numbers.js @@ -0,0 +1,2 @@ +var example = 123456789; +console.log(example); \ No newline at end of file diff --git a/javascripting/object-properties.js b/javascripting/object-properties.js new file mode 100644 index 0000000..3cb483f --- /dev/null +++ b/javascripting/object-properties.js @@ -0,0 +1,5 @@ +var food = { + types: 'only pizza' +}; + +console.log(food.types); \ No newline at end of file diff --git a/javascripting/objects.js b/javascripting/objects.js new file mode 100644 index 0000000..c99f51b --- /dev/null +++ b/javascripting/objects.js @@ -0,0 +1,7 @@ +var pizza = { + toppings: ['cheese', 'sauce', 'pepperoni'], + crust: 'deep dish', + serves: 2 +}; + +console.log(pizza); \ No newline at end of file diff --git a/javascripting/revising-strings.js b/javascripting/revising-strings.js new file mode 100644 index 0000000..7eac870 --- /dev/null +++ b/javascripting/revising-strings.js @@ -0,0 +1,2 @@ +var pizza = 'pizza is alright'; +console.log(pizza.replace('alright', 'wonderful')); \ No newline at end of file diff --git a/javascripting/rounding-numbers.js b/javascripting/rounding-numbers.js new file mode 100644 index 0000000..a99123d --- /dev/null +++ b/javascripting/rounding-numbers.js @@ -0,0 +1,3 @@ +var roundUp = 1.5; +var rounded = Math.round(roundUp); +console.log(rounded); \ No newline at end of file diff --git a/javascripting/string-length.js b/javascripting/string-length.js new file mode 100644 index 0000000..a0d32b6 --- /dev/null +++ b/javascripting/string-length.js @@ -0,0 +1,2 @@ +var example = 'example string'; +console.log(example.length); \ No newline at end of file diff --git a/javascripting/strings.js b/javascripting/strings.js new file mode 100644 index 0000000..0cfa225 --- /dev/null +++ b/javascripting/strings.js @@ -0,0 +1,2 @@ +var someString = 'this is a string'; +console.log(someString); \ No newline at end of file diff --git a/javascripting/variables.js b/javascripting/variables.js new file mode 100644 index 0000000..06bc2b0 --- /dev/null +++ b/javascripting/variables.js @@ -0,0 +1,2 @@ +var example = 'some string'; +console.log(example); \ No newline at end of file