




版權(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ì)自己和他人造成任何形式的傷害或損失。
最新文檔
- 房屋裝修物業(yè)合同
- 河北社工考試試題及答案
- 幼兒園設(shè)計(jì)數(shù)字初步應(yīng)用的小題型及答案
- 數(shù)字與實(shí)物配對(duì)的試題及答案
- 入團(tuán)面試試題及答案大全
- 新能源汽車的用戶行為模式研究試題及答案
- 心理學(xué)小學(xué)試題及答案
- 樂理考試的音高與節(jié)奏測(cè)定方法試題及答案
- 小學(xué)教師的個(gè)性化學(xué)習(xí)反思策略試題及答案
- 小學(xué)教師如何通過反思提升學(xué)生的學(xué)習(xí)動(dòng)機(jī)試題及答案
- 華大新高考聯(lián)盟2025屆高三4月教學(xué)質(zhì)量測(cè)評(píng)化學(xué)+答案
- 2025年中國防曬護(hù)理洗發(fā)露市場(chǎng)調(diào)查研究報(bào)告
- 建筑材料租賃標(biāo)準(zhǔn)合同范本7篇
- 2025-2030中國太陽能照明系統(tǒng)行業(yè)市場(chǎng)發(fā)展趨勢(shì)與前景展望戰(zhàn)略研究報(bào)告
- 國家電網(wǎng)招聘考試(金融類)專業(yè)考試歷年真題及答案
- 鐵路雨季三防培訓(xùn)課件
- 大學(xué)英語四級(jí)考試2024年12月真題(第一套)Part I Writing
- (部編版)語文四年級(jí)上冊(cè)課外閱讀“天天練”100篇,附參考答案
- 2024-2025學(xué)年新教材高中數(shù)學(xué) 第4章 概率與統(tǒng)計(jì) 4.3 統(tǒng)計(jì)模型 4.3.1 第2課時(shí) 相關(guān)系數(shù)與非線性回歸說課稿 新人教B版選擇性必修第二冊(cè)
- 某電站中控室搬遷施工方案
- 宮內(nèi)早孕的健康宣教
評(píng)論
0/150
提交評(píng)論