+ 8
Why does it not work
I have a problem with this code
37 Answers
+ 3
link the thingy instead of pasting it into a comment
+ 2
This is a forum, not a chat. Please don't put each sentence or thought in an individual comment – it just bloats the thread and makes it hard to read.
0 + "1" becomes a string because "1" is a string, so Javascript assumes you want to concatenate strings.
+ 1
That doesn't make it better.
+ 1
Sorry... 😅
The use of thingy threw me off.
+ 1
I made 2 examples, one with the minus, one with the plus button.
https://sololearn.com/compiler-playground/WoT73u5wl4Xn/?ref=app
+ 1
Do not make 1 a string. Leave it as number.
"1" is a string
1 is a number
Add 1, not "1"
+ 1
So you need to check first if num1 == null, then concatenate accordingly
+ 1
So what's the problem?
Do you have new code?
+ 1
Yes, you can nest as many as you like!
0
<button onclick="plusOrMinus = false;
window.onload = function(){
document.getElementById('output').innerHTML = 'Ergebnis: ' + plusOrMinus;
};">-</button>
0
It doesnt display the thingy when i press -
0
Ihr könnt beide auf Deutsch schreiben 😉
0
If you want people to press buttons in order to check on thingies, link your code.
I would assume the function definition doesn't work, but the code is pasted in a comment.
People will only put as much effort in answering a question as the person asking puts in posing their question.
0
Its not set to public tho
0
Do i need to?
0
Now it is
0
Gifs?
0
I got another problem
0
Now im trying to get the calculator logic to work and i create the num1 var as null