okay here is my updated code with what i think is the coutner , but the code doesnt seem to run. please help
Code:
<script type="text/javascript">
var score = 0
question_call()
function main(){
var num = 15
var y = 0
for(1=1;i<15;i++){
var x = math.floor(math.random()*num)+1
while (x==y){
var x = math.floor(math.random()*num+1
}
}
}
function correct(){
score = score + 1;
}
function wrong(){
score = score - 1;
}
function question_call(){
main()
if(x == 1){
question1()
}else if(x == 2){
question2()
}else if(x == 3){
question3()
}else if(x == 4){
question4()
}else if(x == 5){
question5()
}else if(x == 6){
question6()
}else if(x == 7){
question7()
}else if(x == 8){
question8()
}else if(x == 9){
question9()
}else if(x == 10){
question10()
}else if(x == 11){
question11()
}else if(x == 12){
question12()
}else if(x == 13){
question13()
}else if(x == 14){
question14()
}else (x == 15){
question15()
}
function question1(){
var question_1 = prompt("Who Is The Villan In Star Wars?")
if(question_1 == "Darth Vader"){
correct()
main()
}
else {
wrong()
main()
}
function question2(){
var question_1 = prompt("Who Is The second Villan In Star Wars ?")
if(question_1 == "Darth Maul"){
correct()
main()
}
else {
wrong()
main()
}
function question3(){
var question_1 = prompt("Who Is The4 Villan In Star Wars?")
if(question_1 == "Darth Vader"){
correct()
main()
}
else {
wrong()
main()
}
function question4(){
var question_1 = prompt("Who Is The 4Villan In Star Wars?")
if(question_1 == "Darth Vader"){
correct()
main()
}
else {
wrong()
main()
}
function question5(){
var question_1 = prompt("Who Is The Vi4llan In Star Wars?")
if(question_1 == "Darth Vader"){
correct()
main()
}
else {
wrong()
main()
}
function question6(){
var question_1 = prompt("Who Is The Vi4llan In Star Wars?")
if(question_1 == "Darth Vader"){
correct()
main()
}
else {
wrong()
main()
}
function question7(){
var question_1 = prompt("Who Is 4The Villan In Star Wars?")
if(question_1 == "Darth Vader"){
correct()
main()
}
else {
wrong()
main()
}
function question8(){
var question_1 = prompt("Who Is The Villan In Star Wars?")
if(question_1 == "Darth Vader"){
correct()
main()
}
else {
wrong()
main()
}
function question9(){
var question_1 = prompt("Who Is The Villan I4n Star Wars?")
if(question_1 == "Darth Vader"){
correct()
main()
}
else {
wrong()
main()
}
function question10(){
var question_1 = prompt("Who Is The4 Villan In Star Wars?")
if(question_1 == "Darth Vader"){
correct()
main()
}
else {
wrong()
main()
}
function question11(){
var question_1 = prompt("Who Is The Villan In Star Wars?")
if(question_1 == "Darth Vader"){
correct()
main()
}
else {
wrong()
main()
}
function question12(){
var question_1 = prompt("Who Is The Villan In Star Wars?")
if(question_1 == "Darth Vader"){
correct()
main()
}
else {
wrong()
main()
}
function question13(){
var question_1 = prompt("Who Is The Villan In Star Wars?")
if(question_1 == "Darth Vader"){
correct()
main()
}
else {
wrong()
main()
}
function question14(){
var question_1 = prompt("Who Is The Villan In Star Wars?")
if(question_1 == "Darth Vader"){
correct()
main()
}
else {
wrong()
main()
}
function question15(){
var question_1 = prompt("Who Is The Villan In Star Wars?")
if(question_1 == "Darth Vader"){
correct()
main()
}
else {
wrong()
main()
}
</script>
Bookmarks