Bacancy Technology
Bacancy Technology represents the connected world, offering innovative and customer-centric information technology experiences, enabling Enterprises, Associates and the Society to Rise™.
12+
Countries where we have happy customers
1050+
Agile enabled employees
06
World wide offices
12+
Years of Experience
05
Agile Coaches
14
Certified Scrum Masters
1000+
Clients projects
1458
Happy customers
Artificial Intelligence
Machine Learning
Salesforce
Microsoft
SAP
July 27, 2023
Reason : Non empty string is always true in JavaScript
In First code if(a === ‘route 1’ || ‘route 2’) in this condition the second condition is always true. So,if(a === ‘route 1’ || ‘route 2’) always return true and condition should be like if(a === ‘route 1′ || a ===’route 2’) for desired output.
In Second code if(a === ‘route 1’ || ‘route 2’ && b === ‘route 1’ || ‘route 2’) in this condition second condition with OR is always true So,if(a === ‘route 1’ || ‘route 2’ && b === ‘route 1’ || ‘route 2’) always return true and condition should be like if(a === ‘route 1’ || a === ‘route 2’ && b === ‘route 1’ || b === ‘route 2’) for desired output.