+ 2

Why is this not working sorry i just started codeing int score = 100;

This question is already answered

26th Jun 2021, 2:05 AM
Isaiah Alexis
Isaiah Alexis - avatar
5 odpowiedzi
+ 6
1. Is the language actually Javascript? Asking, because many get Java and Javascript confused thinking they are the same or are related. 2. If Javascript then no type is needed prior to the variable name, and it should be written usually in 1 of the following 3 ways, depending on your scope needs. score = 100; var score = 100; let score = 100; If you're not sure about the scope I recommend you 1st try using let then var. I don't recommend that you write code using variables with neither let or var as they result in global scope. 3. If Java or another language is what you intended, or this doesn't seem to resolve your issue,, then you'll need to supply more than just a single statement of your code and instead a minimal example.
26th Jun 2021, 2:40 AM
ChaoticDawg
ChaoticDawg - avatar
+ 2
Thx
26th Jun 2021, 2:42 AM
Isaiah Alexis
Isaiah Alexis - avatar
+ 2
In javascript you dont use int you can only use var, let and const
26th Jun 2021, 1:39 PM
Predator
Predator - avatar
+ 1
My attempt is int score = 100;
26th Jun 2021, 2:16 AM
Isaiah Alexis
Isaiah Alexis - avatar
+ 1
Oh
26th Jun 2021, 3:08 PM
Isaiah Alexis
Isaiah Alexis - avatar