分享兴趣,传播快乐,增长见闻,留下美好! 亲爱的您,这里是LearningYard新学苑。 今天小编为大家带来知识集物流运输与配送管理(25),欢迎您的访问。 Shareinterests,spreadhappiness,increaseknowledge,andleaveagoodlegacy! Dearyou,thisisTheLearningYardAcademy。 TodayXiaobianbringsyoutheknowledgesharingofKnowledgeSetLogisticsTransportationandDistributionManagement(4),welcometoyourvisit。 Today,letstalkaboutsixtypesofJavascript。Javascriptisalanguagewithweakvariables。Whenwedefineavariable,wedontpayattentiontoitstype。ThedatatypesofJavaScriptlanguagearecomposedofsixtypes:stringtype,numbertype,Booleantype,nulltype,undefinedtypeandobjecttype。Thefirstfivetypesarebasicdatatypes,followedbyextendeddatatypes。Next,thefunctionsandusageofeachdatatypeareintroducedindetail。 今天我们讲一下Javascript六大类型,Javascript是一个弱变量的语言,当我们定义一个变量的时候会不注重他的类型JavaScript语言的数据类型由字符串型、数字型、布尔型、null型、undefined型和对象型6大类型组成,前面5种为基本数据类型,后面扩展的数据类型,接下来详细地介绍每种数据类型的功能和使用方法。 Today,letstalkaboutsixtypesofJavascript。Javascriptisalanguagewithweakvariables。Whenwedefineavariable,wedontpayattentiontoitstype。ThedatatypesofJavaScriptlanguagearecomposedofsixtypes:stringtype,numbertype,Booleantype,nulltype,undefinedtypeandobjecttype。Thefirstfivetypesarebasicdatatypes,followedbyextendeddatatypes。Next,thefunctionsandusageofeachdatatypeareintroducedindetail。 字符串是用Unicode字符、数字、标点符号等组成的的唯一序列,在JavaScript代码之中则用于表示JavaScript数据类型,字符串由单引号或双引号包裹,双引号定界的字符串中可以再包含单引号,单引号定界的字符串中也可以再包含双引号。 AstringisauniquesequencecomposedofUnicodecharacters,numbers,punctuationmarks,etc。InJavaScriptcode,itisusedtoindicateJavaScriptdatatype。Thestringiswrappedbysinglequotationmarksordoublequotationmarks。Thestringdelimitedbydoublequotationmarkscancontainsinglequotationmarksagain,andthestringdelimitedbysinglequotationmarkscanalsocontaindoublequotationmarksagain。 在JavaScript代码中,数字型变量用的非常广泛,它也是最为基本类型,但它与其他语言的数字类型不同,它并不区别整数型和浮点型,而是统称为浮点型,这种类型既可以表示整数,小数,同时还能使用指数形式可以表示更大或更小的值。 InJavaScriptcode,numericvariableiswidelyused,anditisalsothemostbasictype。However,itisdifferentfromnumerictypesinotherlanguages。Itdoesnotdistinguishbetweenintegertypeandfloatingpointtype,butiscollectivelycalledfloatingpointtype。Thistypecanrepresentbothintegersanddecimals,andcanalsorepresentlargerorsmallervaluesinexponentialform。 与数字类型不同,布尔型变量的值只有固定两种表示,一种是true,另一种是false,前者真,后者假,如果用数字表示,那么,true用1来表示,false用0来表示,布尔型值来源于逻辑性运算符,常用于控制流程。 Differentfromnumerictypes,thereareonlytwofixedrepresentationsofthevalueofBooleanvariables,oneistrue,theotherisfalse,theformeristrueandthelatterisfalse。Ifitisrepresentedbynumbers,then,trueisrepresentedby1,andfalseisrepresentedby0。Booleanvaluesarederivedfromlogicaloperatorsandareoftenusedincontrolprocesses。 在JavaScript代码中,空值型是特殊类型,它只有一个值,就是null,当引用一个未定义对象时,将返回一个null,严格意义上来说,null本质上是一个对象类型,是一个空指针对象类型。 InJavaScriptcode,nulltypeisaspecialtype。Ithasonlyonevalue,whichisnull。Whenanundefinedobjectisreferenced,itwillreturnanull。Strictlyspeaking,nullisessentiallyanobjecttypeandanullpointerobjecttype。 与Null相同,Undefined也是只有一个undefined值,在编写JavaScript代码时,如果定义了一个变量,没有给它赋值,那么,这个变量返回undefined值,这也是变量默认的,与Null型不同之处在于,Null是一个空值,而Undefined表示无值。 SameasNull,UndefinedhasonlyoneUndefinedvalue。WhenwritingJavaScriptcode,ifavariableisdefinedanditisnotassignedavalue,then,thisvariablereturnsanundefinedvalue,whichisalsothedefaultofthevariable。ThedifferencefromNullisthatNullisanullvalue,whileundefinedmeansnovalue。 今天的分享就到这里了。如果您对今天的文章有什么独特的想法,欢迎评论留言,让我们相约明天,祝您今天过得开心快乐! Thatsitfortodayssharing。Ifyouhaveanyuniqueideasfortodaysarticle,pleaseleaveacomment,letusmeettomorrow,Iwishyouahappyday! 翻译:Google翻译 本文由LearningYard新学苑原创,部分图片文字来自网络,如有侵权请联系。 文字排版李仕阳 审核李焕