forked from GCA-Classroom/WD-LL7-DuoLingo-Student-Starter
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathscript.js
More file actions
68 lines (54 loc) · 1.53 KB
/
script.js
File metadata and controls
68 lines (54 loc) · 1.53 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
/*
Duolingo Team Prototype
----------------------
Your goal is NOT to copy the instructor demo.
Your goal is to make PRODUCT DECISIONS using logic.
Focus on:
- conditionals
- comparisons
- randomness
- feedback
*/
/*
Duolingo Team Prototype
----------------------
Your goal is NOT to copy the instructor demo.
Your goal is to make PRODUCT DECISIONS using logic.
*/
// ==============================
// STEP 1: App State
// ==============================
let xpTotal = 0;
const xpRewards = [10, 15, 20];
// ==============================
// STEP 2: DOM Elements
// ==============================
const xpDisplay = document.getElementById("xp-total");
const button = document.getElementById("complete-lesson");
const feedback = document.getElementById("feedback");
// ==============================
// STEP 3: Event Listener
// ==============================
button.addEventListener("click", function () {
// STEP 4: Random XP reward
const earnedXP = xpRewards[Math.floor(Math.random() * xpRewards.length)];
xpTotal += earnedXP;
xpDisplay.textContent = xpTotal;
// STEP 5: CONDITIONAL LOGIC (YOU WRITE THIS)
// Requirements:
// - At least 3 user states
// - Use comparisons
// - Feedback must change based on progress
// TODO:
// if (...)
// else if (...)
// else (...)
});
/*
TEAM QUESTIONS TO DISCUSS:
--------------------------
- Are these XP thresholds right?
- How many learner states should exist?
- What feels motivating vs annoying?
- What would Duolingo want users to FEEL here?
*/