




版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1、JAVASCRIPT QUICKSTARTJIANYUN BAO,SENIOR TECHNICAL EVANGELIST, CHUKONGTHE TECHNOLOGY OF MOBILE GAME DEVELOPMENTWhat is JavaScript ?WHAT IS JAVASCRIPT http:/ IS JAVASCRIPT WHAT IS JAVASCRIPT a cross-platform, object-oriented scripting language01inside a host environment (eg. a web browser)03variable d
2、ata types are not declared (dynamic typing)02Why is JavaScript?WHY IS JAVASCRIPT Functional Programming01Simpler code, rapider development 02Close to natural language, easy to understand03Code management easier04Concurrent programming easier 05Code hot updatehttphttpWHY IS JAVASCRIPT Fullstack javas
3、cript framework for web application developmentWHY IS JAVASCRIPT httpJavaScript basic knowledgeDATA TYPE AND VARIABLESDEFINITIONExplicit use var for assignmentImplicit direct assignmentDATA TYPE AND VARIABLESTYPE CONVERSION subtraction (string number) + addition string joint / numbertoString() boole
4、an / number stringDATA TYPE AND VARIABLESTYPE CONVERSIONparseInt() string integerparseFloat() string float non number string NaNDATA TYPE AND VARIABLESVARIABLEScoverage Local override GlobalBASIC DATA TYPEnumber integer / floatboolean true / falsestring must use or “”undefined created but not initia
5、lized variablesnull variables have not dataCOMPOUND TYPESObject object-orientedArray or OBJECTS or new Array()Functiondefinition function functionName(param, ) call functionName(param, );typeof check data typeCOMPOUND TYPESOPERATOR!= / = check value!= / = check value and data type5 = “5” is true (Au
6、tomatic type conversion)null = undefined is true null = undefined is false , (comma) allow Expression place togerther, finally return the rightest value finally a s value is 13OPERATORinstanceof check the variable whether a instance of some data type refer to typeofOPERATORblocks need but dont need
7、; finallySTATEMENTtry catch exception catchingSTATEMENTwith avoid writing object repeatlySTATEMENTIf else if else two branchesFLOW CONTROLBRANCHswitch multi-brancheswhile / do while loop by expressionFLOW CONTROLLOOPfor loop in sectionFLOW CONTROLLOOPendless loop for in kind of foreach loop FLOW CON
8、TROLLOOPtraverse all elements in the array traverse all attributes of JavaScript object continue stop current loop FLOW CONTROLLOOPbreak stop whole loop stop external loop (name: looper) FUNCTIONDEFINITIONNotice do not need declare return type do not need declare parameter type name function FUNCTIO
9、NDEFINITIONanonymous function FUNCTIONDEFINITIONFunction class anonymous function FUNCTIONDEFINITIONthe number of parameters in constructor is unlimited allow a series of string parameters, and the last one is the executive of the function, the statements are separated by “;” (semicolon)Function cla
10、ss anonymous function FUNCTIONDEFINITIONwhen define a function in JavaScript FUNCTIONFUNCTION, OBJECT, METHOD AND CLASSfunction directly call like Java method object also create a object (Function) method append some object as method class also get a Class, has the same name of the functionFUNCTIONC
11、ALLdirect call usually get the last return value non return, get null use new call return this JavaScript objectFUNCTIONTHISthis instance attribute FUNCTIONATTRIBUTElocal variable use var or not declare variable in the functioninstance attribute this prefixclass attribute function name prefixFUNCTIO
12、NCALL METHODdirect call method xxx.foo(para);use call() dynamically call with all parametersuse apply() dynamically call with arguments (array)PARAMETERTYPEempty parameter input as undefined“Duck Type” check type, attribute, method first USE OBJECTOBJECT-ORIENTEDnotice the definition of function doe
13、s not support inheritance syntax inheritance mechanism is not perfectUSE OBJECTOBJECT AND LINKED DATAnotice the object of JavaScript is linked data like Map in Java, “key-value” USE OBJECTINHERITANCE AND PROTOTYPEnotice use “prototype” as pseudo inheritancemechanismevery class has prototype attributewhen extend function and attribute to prototype, as extend the originalclassCocos2d-JS v2.x use thisCREATE OBJECTuse new create CREATE OBJECTuse object create create null object, add function and attribute CREATE OBJECTuse JSON synta
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 2025年高考历史考前必背超级结论-14个阶段特征
- 2024年中级统计师《统计工作实务》真题及答案解析
- 妇科护理常用药
- 2025年校园安全新标准:危险品存放领用登记操作流程全览
- 2025年湖南省长沙市初中一年级上学期期中语言能力考试试卷
- 2025年室内设计师职业资格考试真题卷-室内设计空间布局与设计效果评估试题
- 教材原理2025年计算机二级MySQL试题及答案
- 2025年护士执业资格考试内科护理学专项护理伦理模拟考试试卷
- 护理业务查房记录
- 贵州省六盘水市钟山区2024-2025学年九年级上学期期末质量监测英语试题(原卷版+解析版)
- 大学生网络安全教育筑牢安全网络防线课件
- DB11-T854-2023占道作业交通安全设施设置技术要求
- (高清版)WS∕T 389-2024 医学X线检查操作规程
- 环卫承包协议
- 运输企业安全生产责任制制度
- 医院护理培训课件:《安全注射》
- 医疗器械劳动合同范本
- 数字华容道-1课时
- 2024-2029年中国醇类燃料行业深度调研及投资前景预测研究报告
- 相约劳动智慧树知到期末考试答案章节答案2024年陕西铁路工程职业技术学院
- 小儿手术患者的心理护理
评论
0/150
提交评论