0

How do u add variables in java

What is wrong with this console.log(“x”) var x=10;

3rd Mar 2022, 4:41 PM
Nandan Joshi
3 Answers
+ 7
Syntax type variableName = value;
4th Mar 2022, 4:50 AM
Vaibhav
Vaibhav - avatar
+ 3
Without quotes. var x=10; console.log(x) Output: 10
3rd Mar 2022, 4:48 PM
Simba
Simba - avatar
+ 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)
3rd Mar 2022, 4:50 PM
Umar Farooq