I want to know that is there any better method to do :
var name = $('input').attr("name") != "undefined" ? $('input').attr("name") : "";
Here i am reading the name attribute of input. My problem is when i read the name for newly created text element, then it was undefined. So for not showing undefined to the user i have to put this check.Now i have to ready so many properties and in all of then the same problem exist so that`s why i want to know that, Is there any better way to deal will this?
Short circuit evaluation: (I love this in JS)