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
### Yuanyuan Yang
4 changes: 2 additions & 2 deletions quiz/vars1.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
{
y = y + 1;
console.log(x+y);
let y = 2;
y = 2;
}
console.log(x);
console.log(y);
Expand All @@ -17,4 +17,4 @@
<body>
<h1> A Web Page </h1>
</body>
</html>
</html>
4 changes: 2 additions & 2 deletions quiz/vars2.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<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);
Expand All @@ -13,4 +13,4 @@
<body>
<h1> A Web Page </h1>
</body>
</html>
</html>
6 changes: 3 additions & 3 deletions quiz/vars3.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
const PI = 3.14159;
{
let radius = 5;
let area = PI * radius * radius;
PI = 3.0;
var area = PI * radius * radius;
//PI = 3.0;
}
console.log(area);

Expand All @@ -15,4 +15,4 @@
<body>
<h1> A Web Page </h1>
</body>
</html>
</html>
15 changes: 7 additions & 8 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>
</html>