In a javascript i am storing an array of values. My question I want to compare each and every index value. When I am using && I am getting error saying

enter image description here

The string message in alert

var result =<value>;
if(result["compiled"] !=  "false") && (result["success"] != "false"))
  alert("Please check you Debug log for the error");

You are missing a parentheses at the start of your if condition.

if(result["compiled"] != "false") && (result["success"] != "false"))

Should be:

if((result["compiled"] != "false") && (result["success"] != "false"))

Or you can omit some brackets:

if(result["compiled"] != "false" && result["success"] != "false")

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.