Primitive - MDN Web Docs Glossary: Definitions of ... - Mozilla
文章推薦指數: 80 %
In JavaScript, a primitive (primitive value, primitive data type) is data that is not an object and has no methods. There are 7 primitive ... SkiptomaincontentSkiptosearchSkiptoselectlanguageMDNWebDocsGlossary:DefinitionsofWeb-relatedtermsPrimitiveChangelanguageExamplePrimitivewrapperobjectsinJavaScriptSeealsoPrimitiveInJavaScript,aprimitive(primitivevalue,primitivedatatype)isdatathatisnotanobjectandhasnomethods.Thereare7 primitivedatatypes:string,number,bigint,boolean,undefined,symbol,and null. Mostofthetime,aprimitivevalueisrepresenteddirectlyatthelowestlevelofthelanguageimplementation. Allprimitivesareimmutable,i.e.,theycannotbealtered.Itisimportantnottoconfuseaprimitiveitselfwithavariableassignedaprimitivevalue.Thevariablemaybereassignedanewvalue,buttheexistingvaluecannotbechangedinthewaysthatobjects,arrays,andfunctionscanbealtered.ExampleThisexamplewillhelpyouunderstand thatprimitivevaluesareimmutable.JavaScript//Usingastringmethoddoesn'tmutatethestring varbar="baz"; console.log(bar);//baz bar.toUpperCase(); console.log(bar);//baz //Usinganarraymethodmutatesthearray varfoo=[]; console.log(foo);//[] foo.push("plugh"); console.log(foo);//["plugh"] //Assignmentgivestheprimitiveanew(notamutated)value bar=bar.toUpperCase();//BAZ Aprimitivecanbereplaced,butitcan'tbedirectlyaltered.PrimitivewrapperobjectsinJavaScriptExceptfornullandundefined,allprimitivevalueshaveobjectequivalentsthatwraparoundtheprimitivevalues: Stringforthestringprimitive. Numberforthenumberprimitive. BigIntforthebigintprimitive. Booleanforthebooleanprimitive. Symbolforthesymbolprimitive. Thewrapper'svalueOf()methodreturnstheprimitivevalue.Seealso JavaScriptdatatypes Primitivedatatype(Wikipedia) Glossary JavaScript string number bigint boolean null undefined symbol Foundaproblemwiththispage?EditonGitHubSourceonGitHubReportaproblemwiththiscontentonGitHubWanttofixtheproblemyourself?SeeourContributionguide.Lastmodified:Oct8,2021,byMDNcontributorsChangeyourlanguageSelectyourpreferredlanguageEnglish(US)DeutschEspañolFrançais日本語한국어Português(do Brasil)Русский中文(简体)Changelanguage
延伸文章資訊
- 1primitives在線翻譯 - 海词词典
primitives的英文翻譯是什麼意思,詞典釋義與在線翻譯:. 英英釋義. 名詞primitive: a person who belongs to an early stage of civ...
- 2程序设计中的primitives是什么意思 - 百度知道
计算机图形学(特别是在opengl编程)中primitives指的是图元(如点、线、三角形、四边形等)。 已赞过 已踩过<. 你对这个回答的评价是? 评论 收起.
- 3primitive中文(繁體)翻譯:劍橋詞典
primitive man 原始人. The spiny anteater is a mammal, although a very primitive one. 針鼴屬於哺乳動物,儘管是非常原...
- 4primitive - Yahoo奇摩字典搜尋結果
primitive · adj. 原始的;遠古的;早期的[B];粗糙的;簡單的;未開化的 · n.[C]. 原(始)人;原始事物;純樸的人;文藝復興以前的藝術家;風格純樸如此時期的藝術家 ...
- 5primitives中文 - 查查在線詞典
"primitive" 中文翻譯: adj. 1.原始的,上古的;早期的。 2.古風的,老式... "the primitives" 中文翻譯: 上古藝術; "advance primitive...