Movatterモバイル変換


[0]ホーム

URL:


Menu
×
See More 
Sign In
+1 Get Certified Upgrade For Teachers Spaces Get Certified Upgrade For Teachers Spaces
   ❮     
     ❯   

JS Reference

JS by CategoryJS by Alphabet

JavaScript

JS ArraysJS BooleanJS ClassesJS DatesJS ErrorJS GlobalJS IteratorsJS JSONJS MapsJS MathJS NumbersJS ObjectsJS OperatorsJS AssignmentJS ArithmeticJS ComparisonJS Logical OperatorsJS Bitwise OperatorsJS Misc OperatorsJS PrecedenceJS PromisesJS ProxyJS ReflectJS RegExp PatternsJS RegExp ReferenceJS SetsJS StatementsJS StringsJS Typed ArraysJS Typed Reference

Window

Window ObjectWindow ConsoleWindow HistoryWindow LocationWindow NavigatorWindow Screen

HTML DOM

HTML DocumentsHTML Elements
accessKeyaddEventListener()after()append()appendChild()attributesbefore()blur()childElementCountchildNodeschildrenclassListclassNameclick()clientHeightclientLeftclientTopclientWidthcloneNode()closest()compareDocumentPosition()contains()contentEditabledirfirstChildfirstElementChildfocus()getAttribute()getAttributeNode()getBoundingClientRect()getElementsByClassName()getElementsByTagName()hasAttribute()hasAttributes()hasChildNodes()idinnerHTMLinnerTextinsertAdjacentElement()insertAdjacentHTML()insertAdjacentText()insertBefore()isContentEditableisDefaultNamespace()isEqualNode()isSameNode()isSupported()langlastChildlastElementChildmatches()namespaceURInextSiblingnextElementSiblingnodeNamenodeTypenodeValuenormalize()offsetHeightoffsetWidthoffsetLeftoffsetParentoffsetTopouterHTMLouterTextownerDocumentparentNodeparentElementpreviousSiblingpreviousElementSiblingquerySelector()querySelectorAll()remove()removeAttribute()removeAttributeNode()removeChild()removeEventListener()replaceChild()scrollHeightscrollIntoView()scrollLeftscrollTopscrollWidthsetAttribute()setAttributeNode()styletabIndextagNametextContenttitle
HTML AttributesHTML CollectionHTML NodeListHTML DOMTokenListHTML Styles
alignContentalignItemsalignSelfanimationanimationDelayanimationDirectionanimationDurationanimationFillModeanimationIterationCountanimationNameanimationTimingFunctionanimationPlayStatebackgroundbackgroundAttachmentbackgroundClipbackgroundColorbackgroundImagebackgroundOriginbackgroundPositionbackgroundRepeatbackgroundSizebackfaceVisibilityborderborderBottomborderBottomColorborderBottomLeftRadiusborderBottomRightRadiusborderBottomStyleborderBottomWidthborderCollapseborderColorborderImageborderImageOutsetborderImageRepeatborderImageSliceborderImageSourceborderImageWidthborderLeftborderLeftColorborderLeftStyleborderLeftWidthborderRadiusborderRightborderRightColorborderRightStyleborderRightWidthborderSpacingborderStyleborderTopborderTopColorborderTopLeftRadiusborderTopRightRadiusborderTopStyleborderTopWidthborderWidthbottomboxShadowboxSizingcaptionSidecaretColorclearclipcolorcolumnCountcolumnFillcolumnGapcolumnRulecolumnRuleColorcolumnRuleStylecolumnRuleWidthcolumnscolumnSpancolumnWidthcounterIncrementcounterResetcssFloatcursordirectiondisplayemptyCellsfilterflexflexBasisflexDirectionflexFlowflexGrowflexShrinkflexWrapfontfontFamilyfontSizefontStylefontVariantfontWeightfontSizeAdjustheightisolationjustifyContentleftletterSpacinglineHeightlistStylelistStyleImagelistStylePositionlistStyleTypemarginmarginBottommarginLeftmarginRightmarginTopmaxHeightmaxWidthminHeightminWidthobjectFitobjectPositionopacityorderorphansoutlineoutlineColoroutlineOffsetoutlineStyleoutlineWidthoverflowoverflowXoverflowYpaddingpaddingBottompaddingLeftpaddingRightpaddingToppageBreakAfterpageBreakBeforepageBreakInsideperspectiveperspectiveOriginpositionquotesresizerightscrollBehaviortableLayouttabSizetextAligntextAlignLasttextDecorationtextDecorationColortextDecorationLinetextDecorationStyletextIndenttextOverflowtextShadowtextTransformtoptransformtransformOrigintransformStyletransitiontransitionPropertytransitionDurationtransitionTimingFunctiontransitionDelayunicodeBidiuserSelectverticalAlignvisibilitywidthwordBreakwordSpacingwordWrapwidowszIndex

HTML Events

HTML EventsHTML Event ObjectsHTML Event PropertiesHTML Event Methods

Web APIs

API CanvasAPI ConsoleAPI FetchAPI FullscreenAPI GeolocationAPI HistoryAPI MediaQueryListAPI StorageAPI ValidationAPI Web

HTML Objects

<a><abbr><address><area><article><aside><audio><b><base><bdo><blockquote><body><br><button><canvas><caption><cite><code><col><colgroup><datalist><dd><del><details><dfn><dialog><div><dl><dt><em><embed><fieldset><figcaption><figure><footer><form><head><header><h1> - <h6><hr><html><i><iframe><img><ins><input> button<input> checkbox<input> color<input> date<input> datetime<input> datetime-local<input> email<input> file<input> hidden<input> image<input> month<input> number<input> password<input> radio<input> range<input> reset<input> search<input> submit<input> text<input> time<input> url<input> week<kbd><label><legend><li><link><map><mark><menu><menuitem><meta><meter><nav><object><ol><optgroup><option><output><p><param><pre><progress><q><s><samp><script><section><select><small><source><span><strong><style><sub><summary><sup><table><tbody><td><tfoot><th><thead><tr><textarea><time><title><track><u><ul><var><video>

Other References

CSSStyleDeclarationJS Conversion


The Set add() Method

Example

letters.add("d");
letters.add("e");
Try it Yourself »

If you add equal elements, only the first will be saved:

Example

letters.add("a");
letters.add("b");
letters.add("c");
letters.add("c");
letters.add("c");
letters.add("c");
letters.add("c");
letters.add("c");
Try it Yourself »

Description

Theadd() method inserts a new element into a set.

Note

The primary feature of Set objects is that they only store unique values.

If an attempt is made to add an element that already exists in the set, theadd() method will have no effect,and the set will remain unchanged.


Syntax

set.add(value)

Parameters

ParameterDescription
valueRequired.
The value to add.

Return Value

TypeDescription
SetThe original set object with the added value.

Theadd() method directly modifies the existing Set object.It does not return a new Set object.



Browser Support

set.add() is an ECMAScript6 (ES6 2015) feature.

JavaScript 2015 is supported in all browsers sinceJune 2017:

Chrome
51
Edge
15
Firefox
54
Safari
10
Opera
38
May 2016Apr 2017Jun 2017Sep 2016Jun 2016


×

Contact Sales

If you want to use W3Schools services as an educational institution, team or enterprise, send us an e-mail:
sales@w3schools.com

Report Error

If you want to report an error, or if you want to make a suggestion, send us an e-mail:
help@w3schools.com

W3Schools is optimized for learning and training. Examples might be simplified to improve reading and learning.
Tutorials, references, and examples are constantly reviewed to avoid errors, but we cannot warrant full correctness
of all content. While using W3Schools, you agree to have read and accepted ourterms of use,cookies andprivacy policy.

Copyright 1999-2025 by Refsnes Data. All Rights Reserved.W3Schools is Powered by W3.CSS.


[8]ページ先頭

©2009-2025 Movatter.jp