0
How do u add variables in java
What is wrong with this console.log(âxâ) var x=10;
3 Answers
+ 7
Syntax
type variableName = value;
+ 3
Without quotes.
var x=10;
console.log(x)
Output: 10
+ 1
Its because here you called console.log on a string âxâ while then you define a variable named x with certain value
CORRECTION:
1-define the variable first
2-Then do a function like console.log on it
3-Variable names are not written in quotes(because it will count everything in quotes as string)
var x = 10;
console.log(x)