Skip to content

Commit de00c4e

Browse files
committed
exercises
1 parent 5bc8165 commit de00c4e

File tree

2,167 files changed

+312123
-381
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

2,167 files changed

+312123
-381
lines changed

.DS_Store

4 KB
Binary file not shown.

Js Kursenket/app.js

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
2+
let radioButton = document.getElementsByName("answers");
3+
4+
for (let i = 0; i < radioButton.length; i++){
5+
radioButton[i].addEventListener("click",function(){
6+
let answers = document.getElementsByName("answers");
7+
console.log(answers);
8+
9+
})
10+
}
11+
12+
13+
// radioButton.addEventListener("click", function(){
14+
// takeAnswers()
15+
// });
16+
// function takeAnswers(){
17+
// let answers = document.querySelectorAll("#answers").value;
18+
// }

Js Kursenket/index.html

+50
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
4+
<head>
5+
<meta charset="UTF-8">
6+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
7+
<meta http-equiv="X-UA-Compatible" content="ie=edge">
8+
<link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet">
9+
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.5.0/css/all.css" integrity="sha384-B4dIYHKNBt8Bc12p+WXckhzcICo0wtJAoU8YZTY5qE0Id1GSseTk6S+L3BlXeVIU"
10+
crossorigin="anonymous">
11+
<link rel="stylesheet" href="style.css">
12+
<script src="app.js" defer></script>
13+
<title>Kurs Enkät</title>
14+
</head>
15+
16+
<body>
17+
<div class="header-color">
18+
<h1>JavaScript Quiz</h1>
19+
</div>
20+
<main>
21+
<div class="questions">
22+
<p>Question - 1</p>
23+
<h3> Inside which HTML element do we put the JavaScript?</h3>
24+
<label for="">
25+
<input type="radio" name="answers" id="answers" value="scripting">scripting
26+
</label>
27+
<label for="">
28+
<input type="radio" name="answers" id="answers" value="js">js
29+
</label>
30+
<label for="">
31+
<input type="radio" name="answers" id="answers" value="javascript">javascript
32+
</label>
33+
<label for="">
34+
<input type="radio" name="answers" id="answers" value="script">script
35+
</label>
36+
<label for="">
37+
<input type="radio" name="answers" id="answers" value="html">html
38+
</label>
39+
<label for="">
40+
<input type="radio" name="answers" id="answers" value="body">body
41+
</label>
42+
43+
<button>Next
44+
<i class="fas fa-chevron-right"></i>
45+
</button>
46+
</div>
47+
</main>
48+
</body>
49+
50+
</html>

Js Kursenket/questions.json

+61
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
(function() {
2+
var questions = [
3+
{
4+
question: "Inside which HTML element do we put the JavaScript?",
5+
description: "<p id=\"demo\">This is a demonstration.</p>"
6+
choices: [
7+
"<scripting>",
8+
" <js>",
9+
"<javascript>",
10+
"<script>",
11+
"<html>",
12+
"body"
13+
],
14+
correctAnswer: 2
15+
},
16+
{
17+
question: "What is the correct JavaScript syntax to change the content of the HTML element below?",
18+
choices: [
19+
"document.getElementById(\"demo\").innerHTML = \"Hello World!\";",
20+
"document.getElementByName(\"p\").innerHTML = \"Hello World!\";",
21+
" document.getElement(\"p\").innerHTML = \"Hello World!\";",
22+
" #demo.innerHTML = \"Hello World!\";",
23+
" #demo.innerHTML = \"Hello World!\";",
24+
" #demo.innerHTML = \"Hello World!\";"
25+
],
26+
correctAnswer: 4
27+
},
28+
{
29+
question: "What is 8*9?",
30+
choices: [
31+
72,
32+
99,
33+
108,
34+
134,
35+
156
36+
],
37+
correctAnswer: 0
38+
},
39+
{
40+
question: "What is 1*7?",
41+
choices: [
42+
4,
43+
5,
44+
6,
45+
7,
46+
8
47+
],
48+
correctAnswer: 3
49+
},
50+
{
51+
question: "What is 8*8?",
52+
choices: [
53+
20,
54+
30,
55+
40,
56+
50,
57+
64
58+
],
59+
correctAnswer: 4
60+
}
61+
];

Js Kursenket/style.css

+70
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
* {
2+
box-sizing: border-box;
3+
}
4+
body{
5+
font-family: 'Roboto', sans-serif;
6+
margin: 0px;
7+
}
8+
.header-color{
9+
height: 200px;
10+
background-color: #4dbad4;
11+
}
12+
.header-color h1{
13+
text-align: center;
14+
margin: 0px;
15+
padding-top: 40px;
16+
}
17+
main{
18+
text-align: center;
19+
background-color: #673AB7;
20+
height: 590px;
21+
}
22+
23+
.questions{
24+
background-color: #fff;
25+
display: flex;
26+
flex-direction: column;
27+
width: 50%;
28+
padding: 64px;
29+
position: relative;
30+
top: -90px;
31+
height: 540px;
32+
left: 22%;
33+
}
34+
.questions h3{
35+
text-align: left;
36+
}
37+
.questions label{
38+
padding-top: 10px;
39+
text-align: left;
40+
}
41+
42+
.questions label input{
43+
margin-right: 18px;
44+
cursor: pointer;
45+
}
46+
.questions button{
47+
width: 159px;
48+
font-size: 20px;
49+
padding: 13px;
50+
border-radius: 29px;
51+
position: absolute;
52+
right: 10px;
53+
bottom: 17px;
54+
cursor: pointer;
55+
}
56+
.questions button i {
57+
margin-left: 22px;
58+
}
59+
60+
.questions button:hover{
61+
background-color: #E91E63;
62+
box-shadow: #E91E63 1px 1px 11px 3px;
63+
}
64+
65+
@media screen and (max-width:700px){
66+
.questions{
67+
width:360px;
68+
left: 1%;
69+
}
70+
}

Js Quiz/app.js

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
function max(arr) {
2+
return arr.reduce((acc, val) => {
3+
4+
acc = (acc === undefined || val > acc) ? val : acc
5+
return acc;
6+
}, []);
7+
}
8+
9+
console.log(max([1, 2, 3]));
10+
console.log(max([9, 5, 33]));
11+
12+
13+
function squareSum(arr1) {
14+
return arr1.reduce((acc, val) => {
15+
return acc + val;
16+
}, 0)
17+
}
18+
19+
console.log(squareSum([1, 2, 3]));
20+
console.log(squareSum([5, 7, 2]));

Js Quiz/index.html

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
6+
<meta http-equiv="X-UA-Compatible" content="ie=edge">
7+
<title>Document</title>
8+
</head>
9+
<body>
10+
11+
</body>
12+
<script src="app.js"></script>
13+
</html>

Js Quiz/style.css

Whitespace-only changes.
File renamed without changes.
File renamed without changes.

ShoppingList/app.js renamed to Js todos/app.js

+6-23
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ let btn = document.querySelector("#button");
55
btn.addEventListener('click', function () {
66
addItem();
77
});
8-
8+
let todos = [];
99
function addItem() {
1010
let li = document.createElement('li');
1111
let inputValue = document.querySelector('#input').value;
@@ -17,29 +17,12 @@ function addItem() {
1717
document.querySelector("#ulList").appendChild(li);
1818
}
1919
document.querySelector('#input').value = "";
20-
// var span = document.createElement("SPAN");
21-
// var txt = document.createTextNode("x");
22-
// span.className = "close";
23-
// span.appendChild(txt);
24-
// li.appendChild(span);
20+
21+
todos.push(li)
2522
li.innerHTML += "<button onclick='deleteItem(this);'>Delete</button>";
2623
}
27-
function deleteItem(currentElement){
24+
25+
function deleteItem(currentElement) {
2826
currentElement.parentNode.parentNode.removeChild(currentElement.parentNode);
2927
}
30-
// let closeBtn = document.querySelector(".close");
31-
32-
33-
// closeBtn.addEventListener('click', function () {
34-
// removeItem();
35-
// });
36-
// function removeItem(){
37-
38-
// };
39-
40-
// for (i = 0; i < close.length; i++) {
41-
// close[i].onclick = function () {
42-
// var div = this.parentElement;
43-
// div.style.display = "none";
44-
// }
45-
// }
28+

ShoppingList/index.html renamed to Js todos/index.html

+4-11
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,12 @@
55
<meta name="viewport" content="width=device-width, initial-scale=1.0">
66
<meta http-equiv="X-UA-Compatible" content="ie=edge">
77
<link rel="stylesheet" href="style.css">
8-
8+
<script src="app.js" defer></script>
99
<title>Shopping List</title>
1010
</head>
1111
<body>
12-
<form action="">
13-
<label for="">Enter a new Item </label>
14-
<input type="text" id="input" placeholder="Add Items...">
15-
<button type="button" id="button">Add Item</button>
16-
</form>
17-
<ul id="ulList">
18-
<li>asd</li>
19-
20-
</ul>
21-
<script src="app.js" defer></script>
12+
<script src="https://code.jquery.com/jquery-3.3.1.min.js" integrity="sha256-FgpCb/KJQlLNfOu91ta32o/NMZxltwRo8QtmkMRdAu8="
13+
crossorigin="anonymous"></script>
14+
2215
</body>
2316
</html>
File renamed without changes.

Rollupjs/bundle.js

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
(function () {
2+
'use strict';
3+
4+
let obj = {bar: 'ninja'};
5+
6+
console.log(obj.bar);
7+
8+
}());

Rollupjs/foo.js

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
let obj = {bar: 'ninja'}
2+
export default obj;

Rollupjs/index.html

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
4+
<head>
5+
<meta charset="UTF-8">
6+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
7+
<meta http-equiv="X-UA-Compatible" content="ie=edge">
8+
<link rel="stylesheet" href="style.css">
9+
<script src="bundle.js" defer></script>
10+
<title>Document</title>
11+
12+
</head>
13+
14+
<body>
15+
16+
<script src="https://code.jquery.com/jquery-3.3.1.min.js" integrity="sha256-FgpCb/KJQlLNfOu91ta32o/NMZxltwRo8QtmkMRdAu8="
17+
crossorigin="anonymous"></script>
18+
</body>
19+
20+
</html>

Rollupjs/main.js

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
import foo from './foo.js'
2+
console.log(foo.bar);

Rollupjs/node_modules/.bin/rollup

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Rollupjs/node_modules/@types/estree/LICENSE

+21
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Rollupjs/node_modules/@types/estree/README.md

+16
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)