Step 3: Add learning content as HTML to website
- Introduction to JavaScript
Score: 8
Evaluation & Deliverables:
So this is one of those weeks where I wondered what I was thinking in making my learning contract. I'm sure I'll have more of those weeks. Anyways, I did make all the lesson content for the website, and I did make the HTML tags in the content, but I did not finish getting all the content to the website. Here's a link to the content as a Google Doc: https://docs.google.com/document/d/1gf52E9mVqLaHRre7rFzXgKK6tRs4a05chcjUpzbBUYM/edit?usp=sharingI did get a lot of the pages to the website. I'm pretty close to getting it done. Getting the content written up was the main goal of this week, and I am satisfied with the result.
I spent a lot of time trying to figure out how to do drop-down menu's for my nav bars. I've found some websites explaining how to do it, but I never could get it to fully work on my website. I gave up for now as it wasn't essential.
Many of my lesson pages have an opportunity for learners to practice what they are learning with a practice question. I still need to learn JavaScript to get them running. I'll be excited when they are in. I'm puzzled and looking forward to seeing how I can display content on my website using JavaScript (like feedback comments based on what button users pressed).
-------------------------------------
As part of this week's lesson, I was to make a game of rock, paper, scissors, where I could practice using functions. Here's the result:
var userChoice = prompt("Do you choose rock, paper or scissors?");
var computerChoice = Math.random();
if (computerChoice < 0.34) {
computerChoice = "rock";
} else if(computerChoice <= 0.67) {
computerChoice = "paper";
} else {
computerChoice = "scissors";
}
console.log("Your choice:" + " " + userChoice);
console.log("Computer choice:" + " " + computerChoice);
var compare = function (choice1, choice2) {
if (choice1 === choice2) {
return ("The result is a tie!");
} else if (choice1 === "rock") {
if (choice2 === "scissors") {
return ("rock wins");
} else {
return ("paper wins");
}
} else if (choice1 === "paper") {
if (choice2 === "scissors") {
return ("scissors wins");
} else {
return ("paper wins");
}
} else {
if (choice2 === "paper") {
return ("scissors wins");
} else {
return ("rock wins");
}
}
}
compare (userChoice, computerChoice);
No comments:
Post a Comment