I am trying to convert a string to a boolean in javascript, but I dont know how to do it and the solutions from the internet dont seem to work
I have one variable called data
console.log(data)
console.log(data === "true")
console.log(typeof data)
console.log(typeof "true")
this is my output code
true
false
string
string
this is the output I also tried == but it isnt working too
update: I converted the strings to byte arrays
(12) [0, 116, 0, 114, 0, 117, 0, 101, 0, 13, 0, 10]
(8) [0, 116, 0, 114, 0, 117, 0, 101]
these are the two byte arrays. The upper one is my variable and the lower one is the array of a new created string "true". Can anybody tell where this difference comes from?