OR within complex code

Thank you very much, Dave and Paul.
I didn’t manage to use your code, trying as following (with as less code as possible)

function externalLinks() {  
document.querySelectorAll('a').forEach(function(link) {
  if (link.getAttribute("rel") == 'external' || 
      link.getAttribute("class") == "amazon" || 
  //  link.getAttribute("href").includes('https://')) [not working]
  //  anchor.getAttribute("href").substr(0, 4) === "http";  [not working]
  {
         link.target = "_blank";
  }  
})
}

But, what I didn’t explain enough it that if every http/https worked as external (_blank), I could avoid both rel=external and class=amazon.
Thank you!