Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Create new Dictionary with javascript

Tags:

javascript

c#

I am trying to figure out how to do an C# "function" in javascript but am having no luck!?

Here is the C#:

var parameters = new Dictionary<string,string>
{
    { "link", "http://mysite.com" },
    { "name", "This is an test" }
};

I want to think that I have to use "new Array" but am not sure how to do this?

Any help is appreciated and thanks in advance :-)

like image 974
Mansa Avatar asked Feb 16 '23 10:02

Mansa


1 Answers

Here is a great explanation: JavaScript Associative Arrays Demystified

var parameters = new Array();
parameters['link'] = 'http://mysite.com';
parameters['name'] = 'This is an test';
like image 149
RvdK Avatar answered Feb 18 '23 09:02

RvdK