[Solved]Jquery Question Requirement Using Knowledge Jquery Zybooks Using Angularjs Tutorial Provid Q37036245
jQuery Question
Requirement
Then using your knowledge of jQuery (from ZyBooks) and usingthis AngularJS tutorial provide two distinct implementations of thesame game, one in jQuery and the other one in AngularJS. Bothimplementations need to ask questions about flags, collect users’answers, grade them and provide feedback. They both need to allowthe user to play the game again and again and randomize theselection at the beginning of each game. So the functionality needsto be exactly the same.
JS and DOM code
<html>
<head><title>HomeworkSix</title></head><body>
<script>
var url = “http://silo.cs.indiana.edu:8346/images/”;
function Listener() {
this.questions = [“Australia”, “China”, “Italy”, “United States”,”South Africa”,
“Russia”, “Spain”, “Brazil”];
this.process = function process() {
if (this.message) {
if (this.key) {
this.answer = document.forms[0].answer.value;
if (this.answer == this.key) { this.correct += 1; this.message =”Good! “; }
else { this.message = “Nope. “; }
this.total += 1;
this.message += “Score currently ” + this.correct + ” out of ” +this.total + “.”;
} else
this.message = “Welcome to a new game, score currently: ” +this.correct + ” out of ” +
this.total + “.”;
if (this.questions.length > 0) {
this.key = this.questions.pop();
this.question = “Whose flag is this: <img src=”” + url +this.key + “.png”> ” +
“<input type=”text” name=”answer”> <p>” ;
document.getElementById(“question”).innerHTML =this.question;
} else {
document.getElementById(“question”).innerHTML = “End of game, areyou ready for a new one? <p>”;
this.questions = [“Australia”, “China”, “Italy”, “United States”,”South Africa”, “Russia”,
“Spain”, “Brazil”];
this.correct = 0; this.total = 0; this.key = “”; // initializestate
for (var i = 0; i < 100; i++) {
var index = Math.floor(Math.random() *this.questions.length);
var other = Math.floor(Math.random() *this.questions.length);
var temp = this.questions[index];
this.questions[index] = this.questions[other];
this.questions[other] = temp;
} // this shuffles the array before a new game
}
} else {
this.message = “Welcome to the game, are you ready?”;
this.correct = 0; this.total = 0; this.key = “”; // initializestate
}
document.getElementById(“message”).innerHTML = this.message;
}
}
</script>
<form>
<span id=”message”></span> <p>
<span id=”question”></span>
Press <input type=”button” value=”Proceed”onClick=”a.process()”> to move on.
</form>
<script>
a = new Listener(); a.process();
</script>
</body>
</html>
Expert Answer
Answer to jQuery Question Requirement Then using your knowledge of jQuery (from ZyBooks) and using this AngularJS tutorial provide… . . .
OR

