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


JavaScript Array flatMap()

Example

const myArr = [1, 2, 3, 4, 5, 6];
const newArr = myArr.flatMap(x => [x, x * 10]);
Try it Yourself »

Description

TheflatMap() method maps all array elementsand creates a new flat array.

flatMap() creates a new array from calling a function for every array element.

flatMap() does not execute the function for empty elements.

flatMap() does not change the original array.


Syntax

array.flatMap(function(currentValue, index, arr), thisValue)

Parameters

ParameterDescription
function()Required.
A function to be run for each array element.
currentValueRequired.
The value of the current element.
indexOptional.
The index of the current element.
arrOptional.
The array of the current element.
thisValueOptional.
Default valueundefined.
A value passed to the function to be used as itsthis value.

Return Value

TypeDescription
An arrayAn array with the elements as a result of a callback function and then flattened.


Browser Support

JavaScript ArrayflatMap() is supported in all modern browsers since January 2020:

Chrome 69Edge 79Firefox 62Safari 12Opera 56
Sep 2018Jan 2020Sep 2018Sep 2018Sep 2018



×

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