How does this command don't work and how exactly it works i didn't really get it | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How does this command don't work and how exactly it works i didn't really get it

The command is: Var x = 10; This is the first command 👆🏻 Var x = 100; document.write(x); The 2nd command 👆🏻 Var x = 100; document.write(x); X = 42; document.write (x); The last command 👆🏻 All of them I didn't get it and doesn't work to see what they do any information? I will be really grateful for information!

21st Jun 2022, 4:53 PM
xxtheblade 3
xxtheblade 3 - avatar
8 Answers
+ 1
xxtheblade 3 Learn lesson 3.1 Variables in JavaScript course. Variables are containers for storing data values. The value of a variable can change throughout the program.
22nd Jun 2022, 3:30 AM
A͢J
A͢J - avatar
0
Please tag the appropriate programming language.
21st Jun 2022, 5:04 PM
Justice
Justice - avatar
0
xxtheblade 3 What are you doing? That is JavaScript code document.write is a function which is used to print value on browser. x is a variable with different values Did you try to do in web code?
21st Jun 2022, 6:14 PM
A͢J
A͢J - avatar
0
Okay so first. dont capitalize the V in var. 2nd u have 3 of the same names for your variables. X = 42 doesnt work becuase javascript is case-sensetive. and why it outputs 100, 3 times is because of the same variable names the Var x = 100 which is the last variable to have “x” will output 100. If you want them to output different things change the names
21st Jun 2022, 9:10 PM
Junior
Junior - avatar
0
so basically here: var x = 10; var x = 100; document.write(x); var x = 100; document.write(x); var x = 42; document.write (x);
21st Jun 2022, 9:12 PM
Junior
Junior - avatar
0
justice it's JavaScript
22nd Jun 2022, 3:23 AM
xxtheblade 3
xxtheblade 3 - avatar
0
Your mom what does the variables does i don't have any idea?
22nd Jun 2022, 3:28 AM
xxtheblade 3
xxtheblade 3 - avatar
0
its for storing data i guess u could say. var = variable so ye.
22nd Jun 2022, 3:29 AM
Junior
Junior - avatar