$("#para").text('')
.append($("input.selected").map(function() {
return $(this).val() || null;
}).get().join("<br/> "));
what is the purpose of $(this).val() || null; here?
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.
val()returns the value of an input as a string. An empty string is a falsy value in JS, what that means is that if the string is empty then it will evaluate as false. The OR short-circuit operator||evaluates the code after it if the previous condition is false. So what that code is doing is returningnullif the value is empty.