I have array in javascript like
var arrayHex = [0x50 , 0x4f , 0x53 , 0x54 , 0x20 , 0x2f , 0x20 , 0x48 ,
x54 , 0x54,.. more than 500 hundred elements]
Now I want to do some bit shifting / bits flipping on elements of some slices of above array. For example,
slice(2,6)... slice(30, 50), ... slice (300,400), etc.
After bit shifting/flipping, send this array (bit shifted/flipped) to my function or do some processing on it. Is it possible ? How could I do this in JavaScript?.
EDITED: Actually, i just want to do some manipulation on original array. Means that if I do operation (i.e. bitwise) on slices of my arrayHex (i.e. from index of 10th-20th, 50th-80th, 230- 450, etc.) then these operation must be reflected in original array not on temporary slices... below is my code
var arrayHex = [0x65 , 0x34 , 0x30 , 0x35 , 0x65];
console.log("before slicing: arrayHex = ", arrayHex);
var sliced = arrayHex.slice(1,3);
for (i=0; i<sliced.length; i++)
{
sliced[i]='0x65';
}
console.log("sliced : ",sliced);
console.log("after slicing arrayHex is : ",arrayHex);
the output is :
before slicing: arrayHex = [ 101, 52, 48, 53, 101 ] sliced : [101, 101 ] after slicing arrayHex is : [ 101, 52, 48, 53, 101 ]