Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# learn-js
JavaScript tutorial repo

### REPLACE WITH YOUR FULL NAME
### Daniel Chinn
4 changes: 2 additions & 2 deletions quiz/vars1.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
<script>
// Fix the error in the code below
let x = 1;
var y = 2;
let y = 2;
{
y = y + 1;
console.log(x+y);
let y = 2;
y = 2
}
console.log(x);
console.log(y);
Expand Down
3 changes: 2 additions & 1 deletion quiz/vars2.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@
<head>
<script>
// change the script such that i=0,1,2,3,4 is logged in the console
for (var i = 0; i < 5; i++) {
for (let i = 0; i < 5; i++) {
// setTimeout executes the function after 5 ms
setTimeout(function() {
console.log(i);
}, 0);

}
</script>
</head>
Expand Down
4 changes: 2 additions & 2 deletions quiz/vars3.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
<head>
<script>
// Fix all errors in the code below
const PI = 3.14159;
var PI = 3.14159;
{
let radius = 5;
let area = PI * radius * radius;
var area = PI * radius * radius;
PI = 3.0;
}
console.log(area);
Expand Down
13 changes: 6 additions & 7 deletions quiz/where2putjs.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,18 @@
<meta charset="UTF-8">
<title>Title</title>
<link rel="stylesheet" href="../css/index.css">
<script>
document.getElementById("demo").textContent = "A paragraph";
function myFunction() {
document.getElementById("demo").textContent = "Paragraph changed after click.";
}
</script>
</head>
<body>
<div id="root">
<h2>Demo JavaScript in Body</h2>
<p id="demo"> Placeholder ... </p>
<button type="button" onclick="myFunction()">Try it</button>
</div>

<script>
document.getElementById("demo").textContent = "A paragraph";
function myFunction() {
document.getElementById("demo").textContent = "Paragraph changed after click.";
}
</script>
</body>
</html>