I want to check if the "href" of an `<a>` tag is empty, if that's true it should alert something like "The site isn't available atm", if the link is correct it should do nothing.

HTML

```
<a onclick="testif();" class="link" href="www.google.com">This Link is defined</a>
<a onclick="testif();" class="link" href="">This Link is undefined</a>

```

JavaScript

```
function testif(){
    if (document.getElementsByClassName("link").getAttribute("href") == ""){
    Alert("Site isn't available")

    }else {

    // if the link is correct, alert nothing
   }
};        

```

Thanks :)