I have some simple code, and yet am receiving an unexpected result.
Let's take a look at the following function:
const test2 = () => {
let containsBitcoin = false
const str2 = "buy bitcoin"
if (str2.includes('bitcoin')) {
let containsBitcoin = true
}
return containsBitcoin
}
However, when I try to log the result using
console.log(test2())
I am getting false. I can't seem to understand why.
Here is the stackblitz link for reference.