![《cocos2d-js教學(xué)》javascript_quicksta_第1頁](http://file3.renrendoc.com/fileroot_temp3/2022-3/8/f36284ae-7058-4803-8cb5-0f5fcec745bf/f36284ae-7058-4803-8cb5-0f5fcec745bf1.gif)
![《cocos2d-js教學(xué)》javascript_quicksta_第2頁](http://file3.renrendoc.com/fileroot_temp3/2022-3/8/f36284ae-7058-4803-8cb5-0f5fcec745bf/f36284ae-7058-4803-8cb5-0f5fcec745bf2.gif)
![《cocos2d-js教學(xué)》javascript_quicksta_第3頁](http://file3.renrendoc.com/fileroot_temp3/2022-3/8/f36284ae-7058-4803-8cb5-0f5fcec745bf/f36284ae-7058-4803-8cb5-0f5fcec745bf3.gif)
![《cocos2d-js教學(xué)》javascript_quicksta_第4頁](http://file3.renrendoc.com/fileroot_temp3/2022-3/8/f36284ae-7058-4803-8cb5-0f5fcec745bf/f36284ae-7058-4803-8cb5-0f5fcec745bf4.gif)
![《cocos2d-js教學(xué)》javascript_quicksta_第5頁](http://file3.renrendoc.com/fileroot_temp3/2022-3/8/f36284ae-7058-4803-8cb5-0f5fcec745bf/f36284ae-7058-4803-8cb5-0f5fcec745bf5.gif)
版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡介
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等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。
最新文檔
- 2025至2031年中國牙鉆車下部組件行業(yè)投資前景及策略咨詢研究報(bào)告
- 2025至2031年中國單滾筒式木材剝皮機(jī)行業(yè)投資前景及策略咨詢研究報(bào)告
- 2025至2030年中國釣魚眼鏡數(shù)據(jù)監(jiān)測研究報(bào)告
- 2025至2030年中國迷你投影儀數(shù)據(jù)監(jiān)測研究報(bào)告
- 2025至2030年中國壓膠條數(shù)據(jù)監(jiān)測研究報(bào)告
- 2025至2030年中國醫(yī)用家具數(shù)據(jù)監(jiān)測研究報(bào)告
- 2025年中國碧芽春茶市場調(diào)查研究報(bào)告
- 壓縮機(jī)在照明行業(yè)的氣體填充技術(shù)考核試卷
- 公共設(shè)施管理的績效評(píng)價(jià)考核試卷
- 健康心血管健康與血脂管理考核試卷
- 2025年個(gè)人學(xué)習(xí)領(lǐng)導(dǎo)講話心得體會(huì)和工作措施例文(6篇)
- 2025大連機(jī)場招聘109人易考易錯(cuò)模擬試題(共500題)試卷后附參考答案
- 2020-2025年中國中小企業(yè)行業(yè)市場調(diào)研分析及投資戰(zhàn)略咨詢報(bào)告
- 2025-2030年中國電動(dòng)高爾夫球車市場運(yùn)行狀況及未來發(fā)展趨勢分析報(bào)告
- 物流中心原材料入庫流程
- 河南省濮陽市2024-2025學(xué)年高一上學(xué)期1月期末考試語文試題(含答案)
- 長沙市2025屆中考生物押題試卷含解析
- 2024年08月北京中信銀行北京分行社會(huì)招考(826)筆試歷年參考題庫附帶答案詳解
- 2024年芽苗菜市場調(diào)查報(bào)告
- 蘇教版二年級(jí)數(shù)學(xué)下冊(cè)全冊(cè)教學(xué)設(shè)計(jì)
- 職業(yè)技術(shù)學(xué)院教學(xué)質(zhì)量監(jiān)控與評(píng)估處2025年教學(xué)質(zhì)量監(jiān)控督導(dǎo)工作計(jì)劃
評(píng)論
0/150
提交評(píng)論