How can I do bitwise operation between string and hexadecimal?
I need to use input of string to bitwise OR with hexadecimal and result should be hexadecimal.
First, input is string of time.
So 23:00 would be ["23", "00"].
Then I need it in hexadecimal as it is. For example, 23->0x23, 11->-0x11.
Now, bitwise OR with hexadecimal. But it doesn't give the result I want.
Expected result of (time[0] | 0x80) is 0xA3, where time[0] is 0x23 (0x isn't necessary)
Below is what I coded.
let input = "23:00"
let time = input.split(":"); //--> ["23","00"]
console.log(time[0] | 80); //--> 87
console.log(time[0] | "80"); //--> 87
console.log("0x"+time[0] | 80); //--> 115
console.log("0x"+time[0] | "0x80") //--> 163