+ 8

Why does it not work

I have a problem with this code

14th Mar 2024, 4:15 PM
Ma Boi
Ma Boi - avatar
37 Answers
+ 3
link the thingy instead of pasting it into a comment
14th Mar 2024, 4:28 PM
Lisa
Lisa - avatar
+ 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.
15th Mar 2024, 10:06 AM
Lisa
Lisa - avatar
+ 1
That doesn't make it better.
14th Mar 2024, 8:01 PM
Lisa
Lisa - avatar
+ 1
Sorry... 😅 The use of thingy threw me off.
14th Mar 2024, 8:03 PM
Ausgrindtube
Ausgrindtube - avatar
+ 1
I made 2 examples, one with the minus, one with the plus button. https://sololearn.com/compiler-playground/WoT73u5wl4Xn/?ref=app
15th Mar 2024, 8:19 AM
Lisa
Lisa - avatar
+ 1
Do not make 1 a string. Leave it as number. "1" is a string 1 is a number Add 1, not "1"
15th Mar 2024, 10:30 AM
Lisa
Lisa - avatar
+ 1
So you need to check first if num1 == null, then concatenate accordingly
15th Mar 2024, 4:33 PM
Lisa
Lisa - avatar
+ 1
So what's the problem? Do you have new code?
15th Mar 2024, 4:34 PM
Lisa
Lisa - avatar
+ 1
Yes, you can nest as many as you like!
15th Mar 2024, 4:40 PM
Lisa
Lisa - avatar
0
<button onclick="plusOrMinus = false; window.onload = function(){ document.getElementById('output').innerHTML = 'Ergebnis: ' + plusOrMinus; };">-</button>
14th Mar 2024, 4:15 PM
Ma Boi
Ma Boi - avatar
0
It doesnt display the thingy when i press -
14th Mar 2024, 4:16 PM
Ma Boi
Ma Boi - avatar
0
Ihr könnt beide auf Deutsch schreiben 😉
14th Mar 2024, 7:59 PM
Ausgrindtube
Ausgrindtube - avatar
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.
14th Mar 2024, 8:13 PM
Lisa
Lisa - avatar
0
Its not set to public tho
15th Mar 2024, 6:26 AM
Ma Boi
Ma Boi - avatar
0
Do i need to?
15th Mar 2024, 6:27 AM
Ma Boi
Ma Boi - avatar
0
Now it is
15th Mar 2024, 6:27 AM
Ma Boi
Ma Boi - avatar
0
Gifs?
15th Mar 2024, 8:10 AM
Ma Boi
Ma Boi - avatar
0
I got another problem
15th Mar 2024, 10:02 AM
Ma Boi
Ma Boi - avatar
0
Now im trying to get the calculator logic to work and i create the num1 var as null
15th Mar 2024, 10:02 AM
Ma Boi
Ma Boi - avatar