Skip to content

Commit ce0fd49

Browse files
committed
"Finished all the challenges. Yay!"
1 parent d5305a9 commit ce0fd49

13 files changed

+65
-0
lines changed

accessing-array-values.js

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
var food = ['apple','pizza','pear'];
2+
console.log(food[1]);

array-filtering.js

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
var numbers = [1,2,3,4,5,6,7,8,9,10];
2+
var filtered = numbers.filter(function(number){
3+
return (number % 2 === 0);
4+
});
5+
console.log(filtered);

arrays.js

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
var pizzaToppings = ['tomato sauce','cheese','pepperoni'];
2+
console.log(pizzaToppings);

for-loop.js

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
var total = 0;
2+
var limit = 10;
3+
for (i = 0; i < limit; i++){
4+
total+=i;
5+
}
6+
console.log(total);

function-arguments.js

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
function math (x, y, z) {
2+
return (y*z) + x;
3+
}
4+
console.log(math(53,61,67));

functions.js

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
function eat (food) {
2+
return food + ' tasted really good.';
3+
}
4+
console.log(eat('bananas'));

if-statement.js

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
var fruit = 'orange';
2+
if (fruit.length > 5) {
3+
console.log('The fruit name has more than five characters.');
4+
} else {
5+
console.log('The fruit name has five characters or less.');
6+
}

looping-through-arrays.js

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
var pets = ['cat','dog','rat'];
2+
for(i = 0; i<pets.length;i++){
3+
pets[i] = pets[i] + 's';
4+
}
5+
console.log(pets);

number-to-string.js

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
var n = 128;
2+
n = n.toString();
3+
console.log(n);

object-properties.js

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
var food = {
2+
types: 'only pizza'
3+
};
4+
console.log(food.types);

objects.js

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
var pizza = {
2+
toppings: ['cheese','sauce','pepperoni'],
3+
crust: 'deep dish',
4+
serves: 2
5+
};
6+
console.log(pizza);

rounding-numbers.js

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
var roundUp = 1.5;
2+
var rounded = Math.round(roundUp);
3+
console.log(rounded);

scope.js

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
var a = 1, b = 2, c = 3;
2+
3+
(function firstFunction(){
4+
var b = 5, c = 6;
5+
(function secondFunction(){
6+
var b = 8;
7+
console.log('a: '+a+', b: '+b+', c: '+c);
8+
(function thirdFunction(){
9+
var a = 7, c = 9;
10+
(function fourthFunction(){
11+
var a = 1, c = 8;
12+
})();
13+
})();
14+
})();
15+
})();

0 commit comments

Comments
 (0)