From b5a58f8cc6cb46b278623020cdc1a3fcc16001b3 Mon Sep 17 00:00:00 2001 From: Geir Okkenhaug Jerstad Date: Fri, 23 Aug 2024 13:46:21 +0200 Subject: [PATCH] liten bug med operatorene --- oppgaver/uke3/krokodille.html | 78 +++++++++++++++++++---------------- 1 file changed, 42 insertions(+), 36 deletions(-) diff --git a/oppgaver/uke3/krokodille.html b/oppgaver/uke3/krokodille.html index 683e8c8..3d9653a 100644 --- a/oppgaver/uke3/krokodille.html +++ b/oppgaver/uke3/krokodille.html @@ -1,59 +1,65 @@ + Krokodille +
Poeng:
-
Lovlige operatorer < og > og = og ==
-
+
Lovlige operatorer '<' og '>' og '=' og '=='
+
+
+ +
+
+
+ + +
- -
-
-
- - -
-
- + function check() { + let operator = document.getElementById("operator").value; + console.log(operator) + if (operator == '=') { + operator == '=='; + } + console.log(eval(number1 + operator + number2)); + if (eval(number1 + operator + number2)) { + ++points; + document.getElementById('points').innerHTML = `${points}`; + } else { + alert('It is Wrong! to use Alert'); + console.log(operator) + } + } + + \ No newline at end of file