├── index.html
├── readme.md
└── main.js
/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | hello world
5 |
6 | Lorem ipsum dolor sit amet consectetur adipisicing elit. Harum nisi
7 | cupiditate, saepe quidem corrupti voluptatibus veritatis rem molestiae
8 | nobis repellendus distinctio? Id doloribus laboriosam voluptatem dolores
9 | qui inventore mollitia voluptatum?
10 |
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/readme.md:
--------------------------------------------------------------------------------
1 | ## Commands
2 | - git init // initialize git (one time command)
3 | - git add . // add to staging area
4 | - git commit -m "updated index.html" // push to local repo with message
5 | - git remote add origin // link github repo to local repo (one time command)
6 | - git remote -v // check linked repo
7 | - git push origin master // push code to remote repo
8 |
9 |
10 | ## Addional commands
11 | - git clone // clone repo
12 | - git status // show status of the repo
13 | - git log // list commits
14 | - git config --global user.name "hamzah-syed"
15 | - git config --global user.email "hamzah.syed17@gmail.com"
16 |
17 | ## Resources
18 | https://education.github.com/git-cheat-sheet-education.pdf
--------------------------------------------------------------------------------
/main.js:
--------------------------------------------------------------------------------
1 |
2 | const Person = function (firstName, birthYear) {
3 | // console.log(this) // {}
4 | this.firstName = firstName
5 | this.birthYear = birthYear
6 |
7 |
8 |
9 | // Never use this
10 | // this.calcAge = function () {
11 | // console.log(2022 - birthYear)
12 | // }
13 | }
14 |
15 |
16 |
17 | Person.prototype.calcAge = function () {
18 | // console.log(2037 - this.birthYear);
19 | return 2037 - this.birthYear
20 | }
21 |
22 |
23 |
24 |
25 | const hamzah = new Person("Hamzah", 2000)
26 | const areeb = new Person("Areeb", 2000)
27 | const arham = new Person("Arham", 2000)
28 |
29 | // 1. New {} is created
30 | // 2. function is called, this = {}
31 | // 3. {} linked to prototype
32 | // 4. function automatically return object
33 |
34 |
35 | // console.log(hamzah)
36 | // console.log(hamzah.hasOwnProperty("calcAge"))
37 |
38 |
39 |
40 |
41 | // class expression
42 | // const PersonCl = class {
43 | // constructor(firstName, birthYear) {
44 | // this.firstName = firstName
45 | // this.birthYear = birthYear
46 | // }
47 | // }
48 | // class declaration
49 | class PersonCl {
50 | constructor(firstName, birthYear) {
51 | this.firstName = firstName
52 | this.birthYear = birthYear
53 | }
54 |
55 | clacAge() {
56 | console.log(2037 - this.birthYear);
57 | }
58 | }
59 |
60 |
61 | const ali = new PersonCl("Ali", 2000)
62 | const hamzah2 = new PersonCl("Hamzah", 2000)
63 |
64 | console.log(ali)
65 |
66 |
--------------------------------------------------------------------------------