I tried that:
var c = $.parseJSON(something here)
and I control that:
c === undefined
This works however it throws error while trying to parse an invalid JSON string. I don’t want it throw that error.
Any advices?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
It’s generally considered bad practice to suppress/ignore errors, instead why not use a try-catch block to capture the exception and do something with it:
If you really don’t need to do anything about the exception at least put a comment to that effect in your
try-catchblock, it’ll make your code more readable when you come back to it later.