University of Sydney_INFO1003_Foundamental of IT_2012 Semester 2
26/08/2012
Variables Variables are used to store a value for your program. Declaring a variable- You can create a variable with the var keyword: yvar total= 100;
- You can also create a variable without the var statement:total= 200; (less preferred!!)
Examples: p<script>var i= 10; var s=“Testing”;</script>
9
JavaScript Data TypesTypeNumbers
DescriptionAre values that can be processed and calculated. You don't don t enclose them in quotation marks. The numbers can be either positive or negative. They can also be integers or floating point. Series of letters and numbers enclosed In Single or double quotation marks. You'll use strings for text you want displayed or values you want passed along. true or false
Examplevar I= 17; var j= 21; var k= -10.005;
Strings
var a=“Hello”; var b=‘goodbye’;
Boolea
n Null is an empty value. Not the same as 0 or“” null is the absence of any value.
var c= true; var d= false; var x= null;
Unlike Java or other programming languages, you do not need to explicitly declare the data type in JavaScript.10
百度搜索“77cn”或“免费范文网”即可找到本站免费阅读全部范文。收藏本站方便下次阅读,免费范文网,提供经典小说教育文库INFO1003_Foundamental of IT_2012 Semester 2_Lecture5.2_Javas(5)在线全文阅读。
相关推荐: