I have a span element which value is 2. I would like to check if the value is greater than 0, but after checked online and implemented every method, it did not work...

Here is the console when I log the $span

[![enter image description here](https://i.stack.imgur.com/vXb8t.png)](https://i.stack.imgur.com/vXb8t.png)

I understand that Cypress works asynchronously, so I use `.then()` to get the text of element. How can I get the value of 2 and do the follow if-else?

HTML

```
<div>
  <span class="badge ml-1 badge-primary">2</span>
</div>

```

```
   cy.get(".badge.ml-1.badge-primary").then(($span)=> {
     if($span.text().includes(0)) {
      doFunction1()
    } else {
      cy.get(xxxxx)
    }
 )}

```