Convert Text to hex

I must convert a text to hex. I wrote this:

var art = 'A';

var arr = ;

arr[0] =art.toString(16);

but the result is always "A".

Is correct this sintax?


What do you want array[0] to be set to?

the value 41.

"A" convert to hex = 41

You want the character code for the character then.

var art = 'A'
msg.payload  = art.charCodeAt(0)
return msg;

That gives you the numeric character code.

ok thanks