Creating a scorekeeper with lists / arrays

Heyo!

For a project, I’ve been assigned to create a program. This program requires some specific things for it to pass. One of these things is a array / list, and I was told a scorekeeper is a good way to implement that. One problem is: I don’t know how.

My code is a breakdown of a video game, with a quiz at the end. I want to create a scorekeeper for said quiz, where clicking the correct answer (out of 4) adds one point, and clicking a wrong answer takes one away AND sends you back to the beginning. (apologies if this isn’t enough information, this is my first forum) Thanks!

Hello @XoTiC

Welcome to freecodecamp forum feel free to ask any queries.

You should add your code in the topic so we can help you out from where you got stucked.

Sadly there’s not a ton to post. My code is all event handlers, dealing with screen changing. Ill post my failed attempts at making the lists:

var score = 0;
onEvent("ScoreAdd", "click", function( ) {
  score = score + 1;
  setText("score", score);
});
onEvent("ScoreMinus", "click", function( ) {
  score = score - 1;
  setText("score", score);
});

All I need is something that does this, just with a list somehow.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.