๐Ÿ“˜array methods

JS โŸฉ object โŸฉ built-in โŸฉ Array โŸฉ methods

  • ๐Ÿ”ฐ accessing elements

    • push() - append element.

    • pop() - remove and return last element.

    • unshift() - prepend element.

    • shift() - remove and return first element.

    • splice - delete/insert elements.

  • filter elements

  • combine elements

    • join - ้€ฃๆŽฅๆ‰€ๆœ‰ๅ…ƒ็ด ใ€ๅˆไฝตๆˆไธ€ๅ€‹ๅญ—ไธฒใ€‚

    • reduce((result, element, index, array) => {...}) -

    • reduceRight - reduce array from highest index to lowest. (from right to left)

  • find & search elements

    • find - ๅ›žๅ‚ณ็ฌฌไธ€ๅ€‹็ฌฆๅˆๆขไปถ็š„ๅ…ƒ็ด ใ€‚ๅฆๅ‰‡ๅ›žๅ‚ณ undefinedใ€‚

    • findIndex - returns index of first matching element, -1 otherwise.

    • includes - ๅˆคๆ–ท้™ฃๅˆ—ๆ˜ฏๅฆๅŒ…ๅซ็‰นๅฎšๅ…ƒ็ด ใ€‚

    • some - ๆธฌ่ฉฆ้™ฃๅˆ—ไธญๆ˜ฏๅฆๆœ‰็ฌฆๅˆๆขไปถ็š„ๅ…ƒ็ด ใ€‚

    • every - returns true if every element satisfies the condition.

  • sort elements

  • transform arrays/elements

Last updated