0

The value of a variable is {}

i am trying to check if its empty or not using if statement.

I have tried the following

if(val)
        {
            console.log("NOT EMPTY");
        }
        else
        {
        console.log("EMPTY");
      }

But this returns NOT EMPTY, meanwhile the array is empty...please help.i am using IONIC

1 Answer 1

1

This has nothing to do with Ionic. It is a basic javascript operation

if(Array.isArray(val)) {
  console.log("NOT EMPTY");
} else {
  console.log("EMPTY");
}
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.