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/functions/multiple-return-values - Multiple return values - The c.

site address: javascript-tutorial.com/functions/multiple-return-values/ redirected to: javascript-tutorial.com/functions/multiple-return-values

site title: Multiple return values - The complete JavaScript Tutorial

Our opinion (on Thursday 19 November 2026 5:12:46 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):

javascript, objects, the, for, web, multiple, return, values, arrays, summary, chapter, article, toc, about, getting, started, basics, control, structures, data, types, built, in, operators, functions, classes, error, handling, regular, expressions, general, bom, dom,

Text of the page (most frequently used words):
the (42), #return (23), #javascript (17), function (16), fullname (13), introduction (12), values (12), and (12), functions (11), name (10), let (10), array (9), multiple (8), getnameparts (8), nameparts (8), this (7), can (7), john (7), for (7), but (6), objects (6), with (6), doe (6), that (6), operators (6), object (5), just (5), keyword (5), operator (5), languages (4), here (4), returning (4), arrays (4), first (4), split (4), firstname (4), lastname (4), methods (4), parameters (4), tutorial (3), article (3), into (3), recursive (3), from (3), more (3), last (3), since (3), alert (3), will (3), use (3), there (3), programming (3), which (3), value (3), web (3), regular (3), expressions (3), catching (3), your (2), language (2), not (2), natively (2), same (2), simply (2), summary (2), properties (2), instead (2), result (2), are (2), easy (2), create (2), look (2), above (2), example (2), already (2), get (2), back (2), when (2), one (2), how (2), because (2), well (2), other (2), possible (2), course (2), means (2), reached (2), returned (2), only (2), work (2), you (2), using (2), optional (2), asp (2), net (2), dom (2), window (2), bom (2), search (2), error (2), types (2), conditional (2), errors (2), try (2), catch (2), fields (2), inheritance (2), getters (2), setters (2), prototypes (2), callback (2), anonymous (2), default (2), basics (2), loops (2), statement (2), toc (2), localization, suggest, correction, contact, com, 2007, 2026, has, been, fully, translated, following, preferred, list, help, translate, click, czech, next, previous, doesn, support, quite, simple, achieve, functionality, mostly, doing, consumer, bit, cleaner, obtain, named, indexes, elegant, solution, might, fly, really, personally, think, make, code, easier, read, nicer, written, version, where, method, once, have, matter, accessing, two, individual, case, display, format, way, our, could, wrote, several, out, supports, works, related, directly, workaround, also, acts, exit, command, soon, exited, caller, situation, second, never, won, returns, some, point, working, likely, urge, define, than, even, consider, takes, full, like, then, splits, both, discussed, fact, many, though, fine, without, ever, anything, wpf, php5, jquery, html5, css3, webforms, mvc, location, history, script, tag, general, replace, capturing, groups, match, regex, flags, options, throwing, finally, handling, static, classes, extension, property, accessors, chaining, nullish, coalescing, ternary, remainder, logical, modify, assign, increment, decrement, arithmetic, comparison, assignment, json, math, date, string, number, built, type, conversion, null, undefined, strings, numbers, booleans, data, while, switch, control, structures, truthy, falsy, variables, basic, syntax, hello, world, tools, need, getting, started, libraries, webbrowser, what, about, chapter, table, contents, complete,


Text of the page (random words):
multiple return values the complete javascript tutorial javascript tutorial toc table of contents chapter article toc introduction function parameters function parameters with default values anonymous functions callback functions recursive functions multiple return values arrays objects summary about javascript what is javascript javascript and the webbrowser javascript libraries getting started the tools you need hello world the basics basic javascript syntax variables truthy falsy control structures the if statement the switch statement loops for and while loops for of and for in data types introduction booleans numbers 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 functions multiple return values we already discussed the fact that functions in javascript as well as in many other programming languages can return a value by using the return keyword it is optional though a function can work just fine without ever returning anything at some point when working with functions you will likely get the urge to define a function that can return more than one value but is that even possible in javascript as an example consider this function which takes a full name like john doe and then splits it up into a first and a last name can we return both values function getnameparts fullname let nameparts fullname split return nameparts 0 return nameparts 1 let fullname john doe only returns john alert getnameparts fullname no of course this won t work because the return keyword also acts as an exit command for the function which means that as soon as the return keyword is reached the function is exited and the value returned to the caller in this situation it just means that only the first name will be returned and the second return keyword is never reached there are several programming languages out there which natively supports multiple return values but because of how the return keyword works in javascript as well as in other related programming languages it s not possible to directly return multiple values but there is of course a workaround arrays one way of returning multiple values is to simply return an array here s how our function from above could look if we re wrote it to return an array function getnameparts fullname let nameparts fullname split return nameparts let fullname john doe let firstname getnameparts fullname 0 let lastname getnameparts fullname 1 doe john alert lastname firstname since we already get an array back when we use the array split method we can just return it once we have an array back from the function it s just a matter of accessing the two individual values in this case we use it to display the name in the last name first name format objects arrays are easy to return but a more elegant solution might be to create an object and return it since we can just create objects on the fly in javascript this is really easy to do and i personally think that it will make the code easier to read and nicer to look at here s a re written version of the above example where we use an object instead of an array function getnameparts fullname let nameparts fullname split let result firstname nameparts 0 lastname nameparts 1 return result let fullname john doe let name getnameparts fullname doe john alert name lastname name firstname we re mostly doing the same here but as the consumer of the getnameparts function it s a bit more cleaner to obtain the first and last name since we can do it with named properties instead of indexes in the array summary javascript doesn t natively support returning multiple values from a function but it s quite simple to achieve the same functionality by simply returning arrays or objects recursive functions previous introduction next this article has been fully translated into the following languages czech is your preferred language not on the list click here to help us translate this article into your language javascript tutorial com 2007 2026 contact us suggest correction localization
Thumbnail images (randomly selected): * Images may be subject to copyright.GREEN status (no comments)

    No Images


    Verified site has: 72 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-72


    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/functions/multiple-return-values/
    Server Microsoft-IIS/10.0
    X-Powered-By ASP.NET
    Date Thu, 19 Nov 2026 05:12:46 GMT
    Connection close
    Content-Length 188
    HTTP/2 200
    cache-control private
    content-type text/html; charset=utf-8
    server Microsoft-IIS/10.0
    set-cookie ASP.NET_SessionId=hafwndglq5vwu3fd1ao3h5ny; 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 05:12:46 GMT
    content-length 22632

    Meta Tags

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

    Load Info

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