Skip to content

Commit 165b1b6

Browse files
committed
first commit
0 parents  commit 165b1b6

19 files changed

+100
-0
lines changed

accessing-array-values.js

Lines changed: 2 additions & 0 deletions
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

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

arrays.js

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

for-loop.js

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

function-arguments.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
function math (one,two,three) {
2+
return (two*three) + one;
3+
}
4+
console.log(math(53,61,67));
5+

functions.js

Lines changed: 4 additions & 0 deletions
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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
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+
}
7+

introduction.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
console.log('hello');

looping-through-arrays.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
var pets = ['cat', 'dog', 'rat'];
2+
3+
4+
for (var i=0; i<pets.length; i++){
5+
pets[i] = pets[i] + 's';
6+
}
7+
console.log(pets);
8+
9+

number-to-string.js

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

numbers.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
var example = 123456789;
2+
console.log(example);

object-properties.js

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

objects.js

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

revising-strings.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
var pizza = 'pizza is alright';
2+
pizza = pizza.replace('alright', 'wonderful');
3+
console.log(pizza);

rounding-numbers.js

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

scope.js

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
var a = 1, b = 2, c = 3;
2+
3+
(function firstFunction() {
4+
var b = 5, c = 6;
5+
6+
(function secondFunction(){
7+
var b = 8;
8+
9+
(function thirdFunction(){
10+
var a = 7, c = 9;
11+
12+
(function fourthFunction(){
13+
var a = 1, c = 8;
14+
})();
15+
16+
17+
18+
19+
})();
20+
console.log("a: "+a+", b: "+b+", c: "+c);
21+
})();
22+
23+
24+
})();
25+

string-length.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
var example = 'example string';
2+
console.log(example.length);

string.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
var someString = 'this is a string';
2+
console.log(someString)

variables.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
var example = 'some string';
2+
console.log(example);

0 commit comments

Comments
 (0)