admin管理员组

文章数量:1353643

This is my object var loginParameters = ["Tander", "ali", "1", "WINDOWS", "2.0", "TOSHIBA-PC"]

And I want to convert this object to byte array that will look like byte[] objName. But I couldn't find anything about this.

How can I succeed this?

This is my object var loginParameters = ["Tander", "ali", "1", "WINDOWS", "2.0", "TOSHIBA-PC"]

And I want to convert this object to byte array that will look like byte[] objName. But I couldn't find anything about this.

How can I succeed this?

Share Improve this question edited Nov 8, 2013 at 13:07 user1838179 asked May 15, 2013 at 7:39 Mehmet InceMehmet Ince 4,18914 gold badges47 silver badges65 bronze badges 2
  • Where is the object man....?? – Prasath K Commented May 15, 2013 at 7:43
  • Sorry about notation. I am not skilled with js. I mean 'loginParamaters' object. – Mehmet Ince Commented May 15, 2013 at 7:46
Add a ment  | 

1 Answer 1

Reset to default 6
var mainbytesArray = [];
for(var i = 0; i < loginParameters.length; i++){
    var bytes = [];
    for (var j = 0; j < loginParameters[i].length; ++j)       
        bytes.push(loginParameters[i].charCodeAt(j));
    mainbytesArray.push(bytes);
}

本文标签: How to cast an object to byte array in javascriptStack Overflow