Here’s the Javascript code:
var _a = _a || [];
Why it uses “||” (logical OR) and “[]” (an empty array) together?
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 expression
_a || []will return_aif it is “truthy”, otherwise[](it is short circuiting, so it only evaluates until one of the operands is ‘true’ or they have all been evaluated).This is essentially checking for null. If
_ais null or undefined (or false, but that is not likely in this scenario) then it is initialized to an empty array.