Skip to content
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 accessing-array-values.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
const food = ['apple', 'pizza', 'pear']
console.log(food[1])
3 changes: 3 additions & 0 deletions array-filtering.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
const numbers = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
const filtered = numbers.filter((number) => number % 2 == 0)
console.log(filtered)
2 changes: 2 additions & 0 deletions arrays.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
const pizzaToppings = ["tomato sauce", "cheese", "pepperoni"]
console.log(pizzaToppings)
5 changes: 5 additions & 0 deletions for-loop.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
let total = 0
const limit = 10
for (let i = 0; i < limit; i++)
total += i
console.log(total)
5 changes: 5 additions & 0 deletions function-arguments.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
function math (a, b, c) {
return b * c + a
}

console.log(math(53,61,67))
5 changes: 5 additions & 0 deletions functions.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
function eat(food) {
return food + ' tasted really good.'
}

console.log(eat("bananas"))
3 changes: 3 additions & 0 deletions if-statement.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
const fruit = "orange"
console.log(fruit.length > 5 ? "The fruit name has more than five characters." :
"The fruit name has five characters or less.")
1 change: 1 addition & 0 deletions introduction.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
console.log('hello')
4 changes: 4 additions & 0 deletions looping-through-arrays.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
const pets = ['cat', 'dog', 'rat']
for (let i = 0; i < pets.length; i++)
pets[i] = pets[i] + 's'
console.log(pets)
2 changes: 2 additions & 0 deletions number-to-string.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
const n = 128
console.log(n.toString())
2 changes: 2 additions & 0 deletions numbers.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
const example = 123456789
console.log(example)
7 changes: 7 additions & 0 deletions object-keys.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
const car = {
make: 'Honda',
model: 'Accord',
year: 2020
}
const keys = Object.keys(car)
console.log(keys)
4 changes: 4 additions & 0 deletions object-properties.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
const food = {
types: 'only pizza'
}
console.log(food.types)
6 changes: 6 additions & 0 deletions objects.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
const pizza = {
toppings: ['cheese', 'sauce', 'pepperoni'],
crust: 'deep dish',
serves: 2
}
console.log(pizza)
2 changes: 2 additions & 0 deletions revising-strings.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
const pizza = 'pizza is alright'
console.log(pizza.replace('alright','wonderful'))
3 changes: 3 additions & 0 deletions rounding-numbers.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
const roundUp = 1.5
const rounded = Math.round(roundUp)
console.log(rounded)
18 changes: 18 additions & 0 deletions scope.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
const a = 1; const b = 2; const c = 3;

(function firstFunction () {
const b = 5; const c = 6;

(function secondFunction () {
const b = 8;

(function thirdFunction () {
const a = 7; const c = 9;

(function fourthFunction () {
const a = 1; const c = 8
})()
})()
console.log(`a: ${a}, b: ${b}, c: ${c}`)
})()
})()
2 changes: 2 additions & 0 deletions string-length.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
const example = 'example string'
console.log(example.length)
2 changes: 2 additions & 0 deletions strings.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
const someString = 'this is a string'
console.log(someString)
2 changes: 2 additions & 0 deletions variables.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
const example = 'some string'
console.log(example)