Hi guys can anyone help me i need to learn how to use OR and AND in loop conditions using javascript

Re: how to use OR and AND 80 80

Just like every other programming languages, javascript has OR and AND functionality.
&& means AND in javascript while|| means OR in javascript.

Example

  <script>

    function showAlert()
       {
   var flag=0;
   if(flag != "" && flag == 0)
   {
   alert ("The flag is zero");
    }
   else if(flag != "" && flag == 0 || flag == 1)
    {
    alert ("The flag is either 0 or 1");
    }
   }

    </script>
Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.19 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.