File tree Expand file tree Collapse file tree 5 files changed +50
-1
lines changed Expand file tree Collapse file tree 5 files changed +50
-1
lines changed Original file line number Diff line number Diff line change
1
+ const list = document . createElement ( 'ul' ) ;
2
+
3
+ const thirdElement = document . createElement ( 'li' ) ;
4
+ thirdElement . textContent = 'Troisième élément' ;
5
+ list . appendChild ( thirdElement ) ;
6
+
7
+ const secondElement = document . createElement ( 'li' ) ;
8
+ secondElement . textContent = 'Second élément' ;
9
+ list . insertAdjacentElement ( 'afterbegin' , secondElement ) ;
10
+ document . body . appendChild ( list ) ;
Original file line number Diff line number Diff line change 10
10
11
11
< body >
12
12
< div class ="items ">
13
+ < p class ="item " id ="me "> C'est moi</ p >
13
14
< p > Hi I'm a item</ p >
14
15
< div >
15
16
< h2 > Sub Div</ h2 >
@@ -20,6 +21,7 @@ <h2>Sub Div</h2>
20
21
< p > Hi I'm a item</ p >
21
22
< p > Hi I'm a item</ p >
22
23
</ div >
24
+ < script src ="./creating.js "> </ script >
23
25
</ body >
24
26
25
27
</ html >
Original file line number Diff line number Diff line change 9
9
</ head >
10
10
11
11
< body >
12
+ < script >
13
+ // function outer() {
14
+ // const outerVar = 'This is the outer var';
15
+ // function inner() {
16
+ // const innerVar = 'I am the inner var';
17
+ // console.log(innerVar);
18
+ // console.log(outerVar);
19
+ // }
20
+ // return inner;
21
+ // }
22
+ // const innerFn = outer();
23
+ // innerFn();
12
24
25
+ // function createGreeting(greeting = '') {
26
+ // const myGreet = greeting.toUpperCase();
27
+ // return function (name) {
28
+ // return `${myGreet} ${name}`;
29
+ // };
30
+ // }
31
+
32
+ // const sayHello = createGreeting('hello');
33
+ // const sayHey = createGreeting('hey');
34
+ // console.log(sayHello('wes'));
35
+ // console.log(sayHello('kait'));
36
+ // console.log(sayHey('kait'));
37
+
38
+ function createGame ( gameName ) {
39
+ let score = 0 ;
40
+ return function win ( ) {
41
+ score ++ ;
42
+ return `Your game ${ gameName } score is ${ score } ` ;
43
+ } ;
44
+ }
45
+
46
+ const pinballGame = createGame ( 'Pinball' ) ;
47
+ const witcherGame = createGame ( 'Witcher' ) ;
48
+ </ script >
13
49
</ body >
14
50
15
51
</ html >
Original file line number Diff line number Diff line change 9
9
</ head >
10
10
11
11
< body >
12
-
12
+ < script src =" ./hoisting.js " > </ script >
13
13
</ body >
14
14
15
15
</ html >
Original file line number Diff line number Diff line change
1
+ console . log ( 'hey' ) ;
You can’t perform that action at this time.
0 commit comments