INFO1003_Foundamental of IT_2012 Semester 2_Lecture5.2_Javas(5)

2021-01-07 10:05

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


INFO1003_Foundamental of IT_2012 Semester 2_Lecture5.2_Javas(5).doc 将本文的Word文档下载到电脑 下载失败或者文档不完整,请联系客服人员解决!

下一篇:研究内容和方法

相关阅读
本类排行
× 注册会员免费下载(下载后可以自由复制和排版)

马上注册会员

注:下载文档有可能“只有目录或者内容不全”等情况,请下载之前注意辨别,如果您已付费且无法下载或内容有问题,请联系我们协助你处理。
微信: QQ: