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

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 developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.