4

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?

2
  • Where is the object man....?? Commented May 15, 2013 at 7:43
  • Sorry about notation. I am not skilled with js. I mean 'loginParamaters' object. Commented May 15, 2013 at 7:46

1 Answer 1

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);
}
Sign up to request clarification or add additional context in comments.

1 Comment

Is there a better way to do this?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.