Skip to content

Commit bd74431

Browse files
committed
week 4 add
1 parent 47274ca commit bd74431

File tree

5 files changed

+134
-0
lines changed

5 files changed

+134
-0
lines changed

codeacademy/module5.js

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
// creating an array
2+
/**
3+
* Creating a list of strings, values, numbers, boolean
4+
*
5+
*/
6+
7+
var names = ["james", "ming", "ashley", "abc"];
8+
// Index of an array
9+
// why does it start with 0
10+
for (var i = 0; i < names.length; i++) {
11+
console.log(names[i]);
12+
}
13+
14+
// Accessing elements - using the index to get the objects
15+
console.log(names[2]);
16+
17+
// update elements
18+
names[1] = "Elijah";
19+
console.log(names);
20+
21+
// check difference between var and let
22+
let height = 20;
23+
const name = "ash";
24+
25+
const hobbies = ["swim", "run", "jumpping", "dash"];
26+
hobbies[2] = "jogging";
27+
console.log(hobbies);
28+
29+
// performance of appending and pushing to arrays
30+
31+
// arrays and function
32+
33+
var elijah = {
34+
name: "Elijah",
35+
gender: "M"
36+
};
37+
38+
function myname() {
39+
console.log("I am running inside");
40+
}
41+
42+
var listOfHumans = [
43+
{
44+
name: myname,
45+
gender: "M"
46+
},
47+
{
48+
name: "Jason",
49+
gender: "M"
50+
},
51+
{
52+
name: "Jovan",
53+
gender: "M"
54+
},
55+
{
56+
name: "Zhi Ming",
57+
gender: "M"
58+
}
59+
];
60+
61+
listOfHumans[0].name();
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
function confirmEnding(word, target) {
2+
// "Never give up and good luck will find you."
3+
// -- Falcor
4+
return word.substring(word.length - target.length, word.length) === target;
5+
}
6+
7+
confirmEnding("Bastian", "tian");

freecodecamp/ming/factorial.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
function factorial(x) {
2+
if (x === 1) {
3+
return 1;
4+
}
5+
return x * factorial(x - 1);
6+
}
7+
8+
function factorial1(x) {
9+
console.time("factorial test");
10+
let result = 1;
11+
for (let i = 1; i <= x; i++) {
12+
result = result * i;
13+
}
14+
console.timeEnd("factorial test");
15+
return result;
16+
}
17+
18+
// console.log(factorial(10000));
19+
console.log(factorial1(10000));

freecodecamp/ming/mutation.js

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
function mutation(arr) {
2+
var firstString = arr[0].toLowerCase();
3+
var secondString = arr[1].toLowerCase();
4+
var letterIsInWord = true;
5+
for (var x1 in secondString) {
6+
if (letterIsInWord) {
7+
for (var x2 in firstString) {
8+
if (secondString[x1] === firstString[x2]) {
9+
letterIsInWord = true;
10+
break;
11+
} else {
12+
letterIsInWord = false;
13+
continue;
14+
}
15+
}
16+
} else {
17+
break;
18+
}
19+
}
20+
return letterIsInWord;
21+
}
22+
23+
console.log(mutation(["marry", "rry"]));

projects/todoApp/README.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
## Building a todo app
2+
3+
Sections
4+
1) Building the front end
5+
3) HTML
6+
1) Input box
7+
2) Dropdown box
8+
3) List of todos
9+
4) CSS
10+
1) Styling the code
11+
5) Javascript / Vuejs
12+
1) Showing my completed todos
13+
2) Showing my pending todos
14+
3) Showing my deleted todos
15+
16+
2) Deploying it to the cloud
17+
1) Hosting your app on digitalocean
18+
19+
3) Integrating it to a database
20+
1) Google Firebase
21+
22+
4) Adding more cool features
23+
1) Login / logout
24+

0 commit comments

Comments
 (0)