If statement not working

I am doing this if statement but i can’t understand why it doesn’t work. Can you please help?

let coin = Number($w('#coins').text);
let cost = Number($w('#price').text);

if (coin > cost) {
    $w('#text4').text = "You can buy this Item"
}

I’m a beginner, but that code works for me. Have you checked all your references? Are you seeing reported errors? When you say it doesn’t work, what exactly is happening?

Here’s what I see when I use the code (I just added an ‘else’ for ‘cannot buy’).


And this…