How to return multiple value from Javascript ?


If you are working with java-script then you might be get scenario to return multiple value from function. Then we can return the multiple value like this code snippet as given below.


<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="MultipleValueReturn.aspx.cs" Inherits="JavaScriptTest.MultipleValueReturn" %>

<!DOCTYPE html>

<html xmlns="">
<head runat="server">
    <script type="text/javascript">
        function test() {
            var no1 = 10;
            var no2 = 20;
            return {
                no1: no1,
                no2: no2

        function showAlertMsg() {
            var no3 = test().no1;
            var no4 = test().no2;

    <form id="form1" runat="server">
    <asp:Button ID="btnSubmit" runat="server" Text="Submit" OnClientClick="showAlertMsg();" />


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.