diff --git a/javascripting/accessing-array-values.js b/javascripting/accessing-array-values.js new file mode 100644 index 0000000..a8af5e6 --- /dev/null +++ b/javascripting/accessing-array-values.js @@ -0,0 +1,2 @@ +var food = ['apple', 'pizza', 'pear']; +console.log(food[1]); diff --git a/javascripting/array-filtering.js b/javascripting/array-filtering.js new file mode 100644 index 0000000..6d13044 --- /dev/null +++ b/javascripting/array-filtering.js @@ -0,0 +1,5 @@ +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); diff --git a/javascripting/arrays.js b/javascripting/arrays.js new file mode 100644 index 0000000..9616d06 --- /dev/null +++ b/javascripting/arrays.js @@ -0,0 +1,2 @@ +var pizzaToppings = ['tomato sauce', 'cheese','pepperoni']; +console.log(pizzaToppings); diff --git a/javascripting/for-loop.js b/javascripting/for-loop.js new file mode 100644 index 0000000..9779ae7 --- /dev/null +++ b/javascripting/for-loop.js @@ -0,0 +1,7 @@ +var total = 0; +var limit = 10; +for(var i = 0;i 5) +{ + console.log("The fruit name has more than five characters."); +} +else +{ + console.log("The fruit name has more than five characters."); +} diff --git a/javascripting/introduction.js b/javascripting/introduction.js new file mode 100644 index 0000000..702f428 --- /dev/null +++ b/javascripting/introduction.js @@ -0,0 +1 @@ +console.log("hello"); diff --git a/javascripting/looping-through-arrays.js b/javascripting/looping-through-arrays.js new file mode 100644 index 0000000..dbd09cd --- /dev/null +++ b/javascripting/looping-through-arrays.js @@ -0,0 +1,6 @@ +var pets = ['cat', 'dog', 'rat']; +for(var i=0;i