Solved

returning array from function in Javascript

Posted on 2014-02-06
4
723 Views
Last Modified: 2014-02-06
Hi,

I'm wondering why the following does not work:

    var aRetCalFinalAmt = [];
    aRetCalFinalAmt['final_amount'] = final_amount;
    aRetCalFinalAmt['monthlypayentamt'] = monthlypayentamt;
    aRetCalFinalAmt['sPackageName'] = sPackageName;
    aRetCalFinalAmt['desire_payment_month'] = desire_payment_month;
    aRetCalFinalAmt['shipping'] = shipping;
    return aRetCalFinalAmt;

Open in new window


How do I return the array?

Thank you<><
0
Comment
Question by:Victor Kimura
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 82

Accepted Solution

by:
leakim971 earned 500 total points
ID: 39839519
0
 

Author Comment

by:Victor Kimura
ID: 39839740
Ok, thanks, leakim971! For some reason, the PHPStorm IDE has some warning that states "Return expression type Array is not assignable to type array".

but it returns successfully. Do you know what that is?
0
 
LVL 82

Expert Comment

by:leakim971
ID: 39839750
No, I'm speaking Javascript with Eclipse or at least PHPEd, I don't know PHPStorm
0
 

Author Comment

by:Victor Kimura
ID: 39839836
Ok, just thought you may know. Thanks, leakim971!
0

Featured Post

Don't Cry: How Liquid Web is Ensuring Security

WannaCry is just the start. Read how Liquid Web is protecting itself and its customers against new threats.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I found this questions asking how to do this in many different forums, so I will describe here how to implement a solution using PHP and AJAX. The logical flow for the problem should be: Write an event handler for the first drop down box to get …
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)

717 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question