
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Convert JavaScript Array to Hash Array
Let us say our JavaScript array is −
<script> var myArr = new Array(5); myArr[0] = "Welcome"; myArr[1] = "to"; myArr[2] = "the"; myArr[3] = "Web"; myArr[4] = "World"; </script>
Now, convert the array into a string using comma as a separator −
document.getElementById('demo1').value = myArr.join(',');
Now, take this to C# −
string[] str = demo.Split(",".ToCharArray());
The above converts the JavaScript array to C#.
Advertisements