2

I've a little question i'd like to test if my clearInterval(playfunction) is true of false and I tought it would work like this

if(clearInterval(play)==true){

    //do this 1

    }
    else{

    //do this 2

    }

But it dosnt work like this...what did I do wrong?

Kind Regards, and thanks for help!

Balanivash
  • 6,709
  • 9
  • 32
  • 48
Raphael
  • 673
  • 1
  • 9
  • 27

2 Answers2

5

clearInterval doesn't return anything. It will always be undefined and never true or false.

Quentin
  • 914,110
  • 126
  • 1,211
  • 1,335
1

What are you trying to test with the result of clearInterval? That function has no return-type.

Michael Aaron Safyan
  • 93,612
  • 16
  • 138
  • 200