0

In javascript I have a variable called length. When I try to test if (length) javascript says it's true even though the value is Zero. What syntax should I use instead of if (length) to test if there is a variable in there?

Robert Harvey
  • 178,213
  • 47
  • 333
  • 501
Mark Entingh
  • 621
  • 6
  • 10

1 Answers1

1

That is how javascript works. To test if the variable is null or not you simply use this syntax if (length != null) ...

Vortex
  • 663
  • 6
  • 7