If you are not sure if the website you would like to visit is secure, you can verify it here. Enter the website address of the page and see parts of its content and the thumbnail images on this site. None (if any) dangerous scripts on the referenced page will be executed. Additionally, if the selected site contains subpages, you can verify it (review) in batches containing 5 pages.
favicon.ico: javascript-tutorial.com/pt/604/built-in-objects/array-methods - Array methods - The complete J.

site address: javascript-tutorial.com/pt/604/built-in-objects/array-methods/ redirected to: javascript-tutorial.com/pt/604/built-in-objects/array-methods

site title: Array methods - The complete JavaScript Tutorial

Our opinion (on Thursday 19 November 2026 16:50:41 UTC):

GREEN status (no comments) - no comments
After content analysis of this website we propose the following hashtags:



Meta tags:

Headings (most frequently used words):

array, javascript, the, for, web, methods, objects, metadata, summary, chapter, article, toc, about, getting, started, basics, control, structures, data, types, built, in, operators, functions, classes, error, handling, regular, expressions, general, bom, dom, at, concat, every, filter, find, findlast, findindex, findlastindex, foreach, includes, indexof, join, map, reverse, slice, some, sort,

Text of the page (most frequently used words):
the (236), array (88), you (51), fruits (48), #method (42), let (39), this (38), will (36), #function (36), and (34), for (31), pineapple (30), banana (30), apple (28), fruit (28), alert (27), index (24), return (23), methods (21), with (21), have (20), article (18), that (17), like (17), item (17), javascript (15), can (15), use (15), sort (14), example (14), filter (14), find (14), instead (13), but (13), not (12), from (12), items (12), test (12), every (12), start (12), introduction (12), numbers (11), true (11), just (10), value (10), here (9), reverse (9), please (9), end (9), then (9), haslongname (9), are (8), see (8), other (8), which (8), new (8), only (8), same (8), arr (8), all (8), pass (8), findindex (8), foreach (8), into (7), some (7), object (7), copy (7), startswitha (7), first (7), slice (7), false (7), previous (6), arrays (6), returns (6), order (6), need (6), call (6), strings (6), when (6), used (6), specify (6), called (6), join (6), includes (6), translation (6), operators (6), has (5), help (5), out (5), they (5), look (5), well (5), number (5), calling (5), more (5), works (5), parameter (5), parameters (5), get (5), one (5), map (5), string (5), how (5), indexof (5), length (5), name (5), metadata (5), operator (5), tutorial (4), list (4), basics (4), them (4), simply (4), values (4), using (4), 180 (4), case (4), where (4), original (4), existing (4), specific (4), want (4), allow (4), postfixfruit (4), each (4), longnamedfruit (4), findlast (4), longer (4), than (4), characters (4), based (4), concat (4), built (4), started (4), objects (4), functions (4), translated (3), languages (3), your (3), language (3), click (3), date (3), because (3), already (3), full (3), reference (3), comes (3), lot (3), useful (3), programming (3), above (3), comparenumbers (3), two (3), parsefloat (3), even (3), several (3), make (3), aware (3), requires (3), signature (3), examples (3), range (3), included (3), include (3), negative (3), any (3), last (3), element (3), exact (3), looking (3), match (3), found (3), whether (3), loop (3), announcefruit (3), findlastindex (3), search (3), matching (3), much (3), about (3), try (3), portuguese (3), web (3), regular (3), expressions (3), catching (3), following (2), translate (2), beginning (2), left (2), obscure (2), summary (2), always (2), after (2), take (2), turn (2), actual (2), finally (2), expected (2), implement (2), our (2), own (2), comparison (2), work (2), simple (2), wrong (2), soon (2), sorting (2), unlike (2), lose (2), unless (2), before (2), change (2), version (2), default (2), right (2), starts (2), since (2), single (2), positive (2), result (2), startswith (2), somefruitsstartwitha (2), could (2), rewrite (2), while (2), counting (2), specifying (2), elements (2), easy (2), again (2), seen (2), inside (2), point (2), provide (2), adding (2), postfixedfruits (2), flexible (2), its (2), pear (2), passing (2), complete (2), control (2), doesn (2), also (2), replace (2), longnamedfruitindex (2), returning (2), checks (2), outcome (2), longnamedfruits (2), should (2), allfruitsstartwitha (2), vegetables (2), greenstuff (2), pretty (2), does (2), retrieve (2), property (2), most (2), info (2), vote (2), translating (2), chapter (2), button (2), asp (2), net (2), dom (2), window (2), bom (2), error (2), types (2), conditional (2), errors (2), catch (2), fields (2), inheritance (2), getters (2), setters (2), prototypes (2), json (2), math (2), loops (2), statement (2), toc (2), localization, contact, com, 2007, 2026, been, fully, preferred, czech, next, mentioned, either, were, described, pop, push, etc, too, complex, reason, vast, amount, functionality, course, fact, extremely, necessary, tasks, notice, ascending, descending, discussed, needs, compared, allows, compare, gives, converted, expect, compares, converting, box, overall, details, earlier, way, clear, difference, second, define, meaning, specified, inclusive, exclusive, backwards, forward, starting, rest, including, don, option, might, sound, complicated, actually, hope, agree, checking, variants, shallow, making, very, three, kinds, logic, needed, long, quite, silly, hopefully, proves, alter, word, results, apply, modified, leaving, untouched, separated, comma, whatever, kind, character, separator, couple, determine, holds, tells, currently, reached, ones, accept, execute, along, structure, makes, over, collections, exactly, accomplish, detailed, explanation, descriptions, feel, free, written, now, passes, locate, filtered, containing, defined, passed, entire, immediately, otherwise, declaring, letter, avocado, broccoli, carrot, append, another, basically, combining, especially, part, important, won, changed, created, merged, however, come, small, benefit, back, easily, mostly, saw, relevant, talked, focus, entirely, offer, through, leave, gave, thorough, declared, accessed, did, bit, manipulation, removing, english, logged, page, reloading, login, satisfied, may, down, reaches, certain, threshold, removed, submit, altered, good, reasons, think, looks, consult, sure, know, fluent, highlighted, border, remember, images, their, titles, current, status, yellow, untranslated, community, working, seems, process, yet, wpf, php5, jquery, html5, css3, webforms, mvc, location, history, script, tag, general, capturing, groups, regex, flags, options, throwing, handling, static, classes, extension, accessors, properties, multiple, recursive, callback, anonymous, optional, chaining, nullish, coalescing, ternary, remainder, logical, modify, assign, increment, decrement, arithmetic, assignment, type, conversion, null, undefined, booleans, data, switch, structures, truthy, falsy, variables, basic, syntax, hello, world, tools, getting, libraries, webbrowser, what, table, contents,


Text of the page (random words):
mbers strings null undefined type conversion built in objects introduction number string array the basics array methods date math json operators introduction the assignment operator comparison operators arithmetic operators increment decrement operators modify and assign operators logical operators remainder operator conditional ternary operator nullish coalescing operator optional chaining operator functions introduction function parameters function parameters with default values anonymous functions callback functions recursive functions multiple return values objects introduction properties methods property accessors getters setters prototypes prototypes inheritance extension classes introduction fields methods getters setters inheritance static fields methods error handling introduction catching errors try catch catching throwing errors try catch finally error types conditional catching regular expressions introduction regex flags options search match with regular expressions using capturing groups search replace with regular expressions javascript for web general introduction window dom bom the script tag javascript for web the bom the window object the history object the location object javascript for web the dom introduction javascript asp net mvc asp net webforms c css3 html5 jquery php5 wpf the community is working on translating this tutorial into portuguese but it seems that no one has started the translation process for this article yet if you can help us then please click more info if you are fluent in portuguese then please help us just point to any untranslated element highlighted with a yellow left border remember that images should have their titles translated as well inside the article and click the translation button to get started or have a look at the current translation status for the portuguese language if you see a translation that you think looks wrong then please consult the original article to make sure and then use the vote button to let us know about it metadata please help us by translating the following metadata for the article chapter if they are not already translated if you are not satisfied with the translation of a specific metadata item you may vote it down when it reaches a certain negative threshold it will be removed please only submit an altered translation of a metadata item if you have good reasons to do so please login to translate metadata already logged in please try reloading the page more info looking for the original article in english built in objects array methods in the previous article i gave you a pretty thorough introduction to arrays in javascript how they are declared and accessed and we even did a bit of manipulation of it by adding and removing items but the built in array objects has a lot more to offer so in this article we ll go through all the most useful methods found on the array object i will leave out only the most obscure methods but for a full list of the methods have a look at this reference methods the built in array object comes with only one relevant property length but since we talked about that in the previous article i ll focus entirely on the methods in this article let s get started array at in the previous article we saw how we could retrieve an item from the array using the index like this let fruits apple pineapple banana alert fruits 1 but we can also use the at method it does mostly the same so you can rewrite the above example to use it like this let fruits apple pineapple banana alert fruits at 1 that s pretty much the same right however it does come with one small benefit you can specify a negative index to start counting from the back of the array instead of from the start this will allow you to easily retrieve the last item like this let fruits apple pineapple banana alert fruits at 1 array concat the concat method will allow you to append one array at the end of another basically combining the items of the two arrays into a new array especially that last part is important the existing arrays won t be changed instead a new array is created based on the merged arrays here s an example let fruits apple pineapple banana let vegetables avocado broccoli carrot let greenstuff fruits concat vegetables alert greenstuff array every the every method will return true or false based on whether all the items in the array can pass the test you provide as a function here s an example function startswitha fruit index arr return fruit startswith a let fruits apple pineapple banana let allfruitsstartwitha fruits every startswitha alert allfruitsstartwitha false we start by declaring a function called startswitha it simply checks whether the name of the fruit starts with the letter a and returns true or false based on the outcome i then pass this function to the every method the every method will call this function startswitha for each item in the array passing in the value fruit the index and even the entire array should you need it if any of the items doesn t pass the test every will immediately return false otherwise at the end it will return true array filter the filter method works much like the every method but instead of just returning true or false filter will return a new array with all the items which passed the test here s an example where i want to get all fruits with a name longer than 5 characters function haslongname fruit index arr return fruit length 5 let fruits apple pineapple banana let longnamedfruits fruits filter haslongname alert longnamedfruits pineapple banana much like in the every example i have defined a function to be called by the filter method in this case called haslongname this function simply checks if the name of the fruit is longer than 5 characters and then it returns true or false based on the outcome i then pass this function to the filter method which will return a filtered copy of the fruits array containing only fruits with a name longer than 5 characters array find array findlast the find method works just like the filter method but instead of returning all items matching the test function it will return the first item which passes the test you can use it to locate a specific item in the array like this function haslongname fruit index arr return fruit length 5 let fruits apple pineapple banana let longnamedfruit fruits find haslongname alert longnamedfruit pineapple this is the exact same example we used for the filter method but instead of filter we now call the find method which will return the first fruit with a name longer than 5 characters pineapple the find method will start from the beginning of the array and return the first matching item if you want to start from the end of the array instead just use the findlast method function haslongname fruit index arr return fruit length 5 let fruits apple pineapple banana let longnamedfruit fruits findlast haslongname alert longnamedfruit banana array findindex array findlastindex if you need to find the index of an item instead of the value of the item you can use the findindex method just like the find method you will pass a test function to it and as soon as this function returns true you get the index of the matching item i have re written the example for the find method to use findindex instead function haslongname fruit index arr return fruit length 5 let fruits apple pineapple banana let longnamedfruitindex fruits findindex haslongname alert longnamedfruitindex 1 for a more detailed explanation of how it works have a look at the above descriptions for filter and find also feel free to replace the findindex with a call to findlastindex if you want to start the search from the end of the array instead of the start array foreach several other programming languages comes with a control structure called foreach which makes it easy to loop over collections like arrays and list javascript doesn t exactly have a foreach loop but with the foreach method found on the array object you can accomplish the same the foreach method will accept a function as a parameter and then execute this function for each element in the array always passing in the index and value of the item along with the complete array for reference here s how you can use it function announcefruit fruit index arr alert fruit number index fruit let fruits apple pineapple banana fruits foreach announcefruit when calling foreach on the array we pass in a function called announcefruit this simple function just tells us which fruit we have currently reached in the loop as well as the index of it as you can see the signature of the function is the same as the ones used in the previous examples for filter find findindex and so on array includes the includes method will allow you to determine whether an array holds a specific value or not like this let fruits apple pineapple banana alert fruits includes apple true alert fruits includes pear false this method is not as flexible as the other methods we have seen like find you will have to specify the exact value you re looking for and if its a string the case has to match as well array indexof the indexof method will return the index of the value you pass as the first parameter or 1 if the item can t be found here s an example let fruits apple pineapple banana alert fruits indexof banana 2 alert fruits indexof pear 1 again this method is not as flexible as the findindex method just like the includes method you will have to specify the exact value you re looking for and if its a string the case has to match as well array join the join method will take the array and join the elements to a string separated by a comma or whatever kind of character you specify as the separator here s a couple of examples on how it works let fruits apple pineapple banana let s1 fruits join apple pineapple banana alert s1 let s2 fruits join apple pineapple banana alert s2 array map use the map method to apply a function to each of the items in the array and then return the modified items as a new array leaving the existing array untouched here s an example function postfixfruit fruit index arr return fruit fruit let fruits apple pineapple banana let postfixedfruits fruits map postfixfruit apple pineapple banana alert fruits apple fruit pineapple fruit banana fruit alert postfixedfruits quite a silly example but hopefully it proves the point we call the map method and provide a function that will alter each element by adding the word fruit at the end as you can see this results in a new array again you will see the same signature for the postfixfruit function as we have seen in other array methods like filter and find where the function will be called with three parameters the value the index and the actual array this will allow you to have all kinds of logic inside the postfixfruit function if needed as long as it returns a value to be used for the new array array reverse the reverse method will reverse the order of the array making the last item the first and so on it s very easy to use as you can see from this example let fruits apple pineapple banana fruits reverse banana pineapple apple alert fruits please be aware that unlike several other array methods the reverse method will change the existing array and not just return a new version of it so when calling the reverse method you lose the original order unless you make a copy of it before calling reverse array slice the slice method will return a shallow copy of the array with the option of specifying a range of elements to be included using one or two parameters it might sound complicated but it s actually not i hope you will agree with me after checking out this example where we use all the variants let fruits apple pineapple banana let f1 fruits slice apple pineapple banana alert f1 let f2 fruits slice 1 pineapple banana alert f2 let f3 fruits slice 1 banana alert f3 let f4 fruits slice 0 2 apple pineapple alert f4 f1 if we don t specify any parameters we ll simply get a full copy of the array f2 the first parameter is the starting index specifying the first item we ll include in the copy when we only include this parameter the rest of the array including the item at the start index is included in the copy f3 like f2 we only specify a start index but we use a negative value if you do that it will start counting backwards from the end of the array instead of forward from the start of the array f4 use the second parameter to define the end of the range of items you want included be aware that while the start index is inclusive the end index is exclusive meaning that the range will not include the item specified by the end index array some we used the every method earlier in this article to test if all items in an array could pass a specific test the some method works the same way but it only requires a single positive result from the test function to return true so let s rewrite the example used for every to use some instead to see the clear difference function startswitha fruit index arr return fruit startswith a let fruits apple pineapple banana let somefruitsstartwitha fruits some startswitha alert somefruitsstartwitha true our test function requires a fruit that starts with a and since we have an apple and some only requires a single positive result the overall test returns true the signature used for the test function startswitha is the same as for other array methods like every filter find and so on so for more details have a look at the other examples of this article array sort the sort method will help you sort the values of an array by default it compares items by converting them into strings so if you have an array of strings the sort method will work just like expected right out of the box let fruits apple pineapple banana fruits sort apple banana pineapple alert fruits please be aware that unlike several other array methods the sort method will change the existing array and not just return a new version of it so when calling the sort method you lose the original order unless you make a copy of it before calling sort as soon as you have an array that are not strings you need to implement your own sorting function this is even true for numbers because when they are converted into strings the sorting will not turn out as you expect as you can see from this example let numbers 1 4 2 10 42 180 numbers sort wrong 1 10 180 4 2 42 alert numbers so let s implement our own comparison function which will work for this simple use case where we need to sort an array of numbers function comparenumbers n1 n2 n1 number parsefloat n1 n2 number parsefloat n2 return n1 n2 let numbers 1 4 2 10 42 180 numbers sort comparenumbers 1 4 2 10 42 180 alert numbers the comparenumbers will take the two values that needs to be compared and turn them into actual numbers using the parsefloat method this allows us to compare them like numbers instead of strings which finally gives us the expected order notice that the sort method always ...
Thumbnail images (randomly selected): * Images may be subject to copyright.GREEN status (no comments)

    No Images


    Verified site has: 74 subpage(s). Do you want to verify them? Verify pages:

    1-5 6-10 11-15 16-20 21-25 26-30 31-35 36-40 41-45 46-50
    51-55 56-60 61-65 66-70 71-74


    Top 50 hastags from of all verified websites.

    Supplementary Information (add-on for SEO geeks)*- See more on header.verify-www.com

    Header

    HTTP/1.1 302 Redirect
    Content-Type text/html; charset=UTF-8
    Location htt????/javascript-tutorial.com/pt/604/built-in-objects/array-methods/
    Server Microsoft-IIS/10.0
    X-Powered-By ASP.NET
    Date Thu, 19 Nov 2026 16:50:41 GMT
    Connection close
    Content-Length 193
    HTTP/2 200
    cache-control private
    content-type text/html; charset=utf-8
    server Microsoft-IIS/10.0
    set-cookie ASP.NET_SessionId=2msoyi0gjp52vg10o0jpza2x; path=/; HttpOnly; SameSite=Lax
    x-aspnetmvc-version 5.2
    x-aspnet-version 4.0.30319
    x-powered-by ASP.NET
    date Thu, 19 Nov 2026 16:50:41 GMT
    content-length 43517

    Meta Tags

    title="Array methods - The complete JavaScript Tutorial"
    name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"

    Load Info

    page size43517
    load time (s)0.202515
    redirect count1
    speed download215430
    server IP 142.132.248.53
    * all occurrences of the string "http://" have been changed to "htt???/"