Attacklab.wmd_env.buttons=Attacklab.wmd_env.buttons||_4;
what does the || do in this case?
Adds _4 to the array which is Attacklab.wmd_env.buttons?
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.
The
||operator in JavaScript returns the value on the left if that value does not evaluate tofalse, otherwise it returns the value on the right.From Mozilla’s Core JavaScript 1.5 Reference:
So, in this case, if
Attacklab.wmd_env.buttonsdoesn’t have a value, it sets the value to_4.