Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Completed exercises #28

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions javascripting/accessing-array-values.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
var food = ['apple', 'pizza', 'pear'];
console.log(food[1]);
5 changes: 5 additions & 0 deletions javascripting/array-filtering.js
Original file line number Diff line number Diff line change
@@ -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);
2 changes: 2 additions & 0 deletions javascripting/arrays.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
var pizzaToppings = ['tomato sauce', 'cheese', 'pepperoni'];
console.log(pizzaToppings);
6 changes: 6 additions & 0 deletions javascripting/for-loop.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
var total = 0;
var limit = 10;
for (i = 0; i < limit; i++) {
total += i;
}
console.log(total);
4 changes: 4 additions & 0 deletions javascripting/function-arguments.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
function math (x, y, z) {
return (y * z) + x;
}
console.log(math(53, 61, 67));
4 changes: 4 additions & 0 deletions javascripting/functions.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
function eat (food) {
return food + ' tasted really good.';
}
console.log(eat('bananas'));
6 changes: 6 additions & 0 deletions javascripting/if-statement.js
Original file line number Diff line number Diff line change
@@ -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.');
}
1 change: 1 addition & 0 deletions javascripting/introduction.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
console.log('hello');
5 changes: 5 additions & 0 deletions javascripting/looping-through-arrays.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
var pets = ['cat', 'dog', 'rat'];
for (i in pets) {
pets[i] = pets[i] + 's';
}
console.log(pets);
2 changes: 2 additions & 0 deletions javascripting/number-to-string.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
var n = 128;
console.log(n.toString());
2 changes: 2 additions & 0 deletions javascripting/numbers.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
var example = 123456789;
console.log(example);
4 changes: 4 additions & 0 deletions javascripting/object-properties.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
var food = {
types: 'only pizza'
};
console.log(food.types);
6 changes: 6 additions & 0 deletions javascripting/objects.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
var pizza = {
toppings: ['cheese', 'sauce', 'pepperoni'],
crust: 'deep dish',
serves: 2
};
console.log(pizza);
3 changes: 3 additions & 0 deletions javascripting/revisiting-strings.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
var pizza = 'pizza is alright';
pizza = pizza.replace('alright', 'wonderful');
console.log(pizza);
3 changes: 3 additions & 0 deletions javascripting/rounding-numbers.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
var roundUp = 1.5;
var rounded = Math.round(roundUp);
console.log(rounded);
14 changes: 14 additions & 0 deletions javascripting/scope.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
var a = 1, b = 2, c = 3;
(function firstFunction() {
var b = 5, c = 6;
(function secondFunction() {
var b = 8;
console.log('a: '+a+', b: '+b+', c: '+c);
(function thirdFunction() {
var a = 7, c = 9;
(function fourthFunction() {
var a = 1, c = 8;
})();
})();
})();
}())
2 changes: 2 additions & 0 deletions javascripting/string-length.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
var example = 'example string';
console.log(example.length);
2 changes: 2 additions & 0 deletions javascripting/strings.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
var someString = 'this is a string';
console.log(someString);
2 changes: 2 additions & 0 deletions javascripting/variables.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
var example = 'some string';
console.log(example);