Monday, 26 February 2018

Learn How to assign value to the multiple variables in the script

Here the values to multiple variables in the same statement by suffixing the variable name with the assignment operator followed by the value for that variable. In addition we can assign the value of one variable to another. Now create a Web page named AssignValToMulVariable.html which shows how to assign values to the multiple variables in the script. 
We can assign

####Showing the Code for the AssignValToMulVariable.html file#####
<!doctype html>
<html>
<head>
<title>Assigning values to multiple Variables</title>
</head>
<body>
<h1>Using Multiple Variable in the Script</h1>
<SCRIPT type="text/javascript">
var countBooks=50, minBookPrice=150, maxBookPrice=3000, bookName;
countBooks=2000;
minBookPrice=500;
maxBookPrice=minBookPrice;
document.write("countBooks="+countBooks+"<br/>");
document.write("maxBookPrice="+maxBookPrice+"<br/>");
document.write("bookName="+bookName);
</SCRIPT>
</body>
</html>


Here The variables countBooks, minBookPrice, maxBookPrice, and bookName are declared in the same statement .

####shows The OutPut of the AssignValToMulVariable.html file####





No comments:

Post a Comment