diff --git a/accessing-array-values.js b/accessing-array-values.js new file mode 100644 index 0000000..eb9efc4 --- /dev/null +++ b/accessing-array-values.js @@ -0,0 +1,2 @@ +var food=['apple','pizza','pear']; +console.log(food[1]); diff --git a/array-filtering.js b/array-filtering.js new file mode 100644 index 0000000..e92e741 --- /dev/null +++ b/array-filtering.js @@ -0,0 +1,6 @@ +var numbers = [1,2,3,4,5,6,7,8,9,10]; +var filtered = numbers.filter( + function(n){ + return n % 2 === 0; + }); +console.log(filtered); diff --git a/arrays.js b/arrays.js new file mode 100644 index 0000000..8f0559e --- /dev/null +++ b/arrays.js @@ -0,0 +1,2 @@ +var pizzaToppings = ['tomato sauce', 'cheese', 'pepperoni']; +console.log(pizzaToppings); diff --git a/for-loop.js b/for-loop.js new file mode 100644 index 0000000..d16b898 --- /dev/null +++ b/for-loop.js @@ -0,0 +1,9 @@ +var total = 0; + +var limit = 10; + +for(var i=0;i5){console.log('The fruit name has more than five characters.');}else{console.log('The fruit name has five characters or less.');} diff --git a/introduction.js b/introduction.js new file mode 100644 index 0000000..e921523 --- /dev/null +++ b/introduction.js @@ -0,0 +1 @@ +console.log('hello'); diff --git a/looping-through-arrays.js b/looping-through-arrays.js new file mode 100644 index 0000000..b6dfc29 --- /dev/null +++ b/looping-through-arrays.js @@ -0,0 +1,5 @@ +var pets = ['cat','dog','rat']; +for(var i=0; i