I'm using jQuery to scan a page, find all the links on the page, and if they have a "title" attribute, output them in the console log.
$("a").each(function () {
    var title = $(this).attr('title');
    if (title !== 'undefined') {
        console.log(title + 'blah');
    }
})
What I cannot understand is that it outputs "undefined" many times as well, despite me specifying that it should not log anything with this value:
if(title !== 'undefined'){
    console.log(title+'blah');
}
Here is an example of the console.log results:
undefinedblah
About WordPressblah
undefinedblah
comments awaiting moderationblah
Newblah
undefinedblah
My Accountblah
undefinedblah
Why are all these undefined options passing my if statement?
 
     
     
    