Skip to content

Commit a29d9a0

Browse files
author
Christopher Harrison
authored
Merge pull request #3 from aaronpowell/main
Adding demo scripts for modules 5, 7 and 15
2 parents 9f8db23 + 34b5523 commit a29d9a0

4 files changed

Lines changed: 65 additions & 0 deletions

File tree

05-variables/demo.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
var hello = "Hello";
2+
3+
console.log(hello);
4+
hello = "Hello World";
5+
console.log(hello);
6+
7+
if (true) {
8+
let world = "Hello World";
9+
console.log(world);
10+
}
11+
// console.log(world);
12+
13+
const aaron = "Aaron";
14+
console.log(aaron);
15+
16+
// aaron = "Aaron Powell"

07-data-types/demo.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
const people = ["Aaron", "Mel", "John"];
2+
const one = 1;
3+
const str = "Hello World";
4+
const b = true;
5+
const person = {
6+
firstName: "Aaron",
7+
lastName: "Powell",
8+
};
9+
10+
function sayHello(person) {
11+
console.log("Hello " + person.firstName);
12+
}

07-data-types/demo_solution.js

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
const people = ["Aaron", "Mel", "John"];
2+
// const one = 1;
3+
const one = new Number(1);
4+
const str = "Hello World";
5+
const b = true;
6+
const person = {
7+
firstName: "Aaron",
8+
lastName: "Powell",
9+
};
10+
11+
function sayHello(person) {
12+
console.log("Hello " + person.firstName);
13+
}
14+
15+
console.log("-- typeof --");
16+
console.log(typeof people);
17+
console.log(typeof one);
18+
console.log(typeof str);
19+
console.log(typeof b);
20+
console.log(typeof person);
21+
console.log(typeof sayHello);
22+
23+
console.log("-- instanceof --");
24+
console.log(people instanceof Array);
25+
console.log(one instanceof Number);
26+
console.log(str instanceof String);
27+
console.log(b instanceof Boolean);
28+
console.log(person instanceof Object);
29+
console.log(sayHello instanceof Function);

15-arrow-functions/demo.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
const add = (a, b) => a + b;
2+
console.log(add(1, 2));
3+
4+
const subtract = (a, b) => {
5+
const result = a - b;
6+
return result;
7+
};
8+
console.log(subtract(1, 1));

0 commit comments

Comments
 (0)