How to convert a String to Bytearray
<p>How can I convert a string in bytearray using Javascript. Output should be eqivalent of the below C# code.</p>

<pre><code>UnicodeEncoding encoding = new UnicodeEncoding();
byte[] bytes = encoding.GetBytes(AnyString);
</code></pre>

<p>As UnicodeEncoding is by default of UTF-16 with Little-Endianness.</p>

<p><strong>Edit:</strong> I have a requirement to match the bytearray generated client side with the one genearated at server side using the above C# code.</p>
