JS-Variable
<Beginner JS><Function><Variable><Loop-If><OOP>
1/ Variable
<script>
var FName=FirstName
</script>
Declaring a variable
var FirstName
var Adress,Phone,Email;
You can declare:
Natural numbers: Integer
Decimal numbers: Double
String: Text
Assigning a value to a variable
Salary=12
or var Salary=12
Display the value
Document.write(Salary)
Addition/Substraction/Multiplication/Division
Document.write(125+40)
Document.write(Salary+50)
Negative
Temp=-31
Function and local variables
Variable declared in a body of a function
....{var custAdress}...
Use Declared variable
function showAdress(){
var custAdress
custAdress="12 Hello"
document.write(custAdress);
}
showAdress();
Comments
Post a Comment