Returning Multiple Values in JAVASCRIPT

function myFunction() {
  var result = testFunction();
   alert(result[0]);//returns "1"
   alert(result[1]);//returns "2"
   alert(result[2]);//returns "3"
}

//This function returns multiple values(a,b,c) in the form of array.
function testFunction() {
  var a="1",b="2",c="3";
    return [a,b,c]
}

Comments

Popular posts from this blog

SQL Server 2008 MERGE statement

I Built an AI Reviewer That Refuses to Tell Me If My Idea Will Work