How to add rel=”sponsored noopener” into script

I would like to ask you for help. I found this code and it is working perfect. It applies custom links to images in Elementor Pro Gallery instead of one link for the gallery. I need to add there somehow rel=”sponsored noopener”. Can somebody help please?

<script>
document.addEventListener('DOMContentLoaded', function () {

let linkedImages = document.querySelectorAll('.e-gallery-item');

let links = [
'link',
'link',
'link',
'link',
'link',
'link'
];

linkedImages.forEach((linkedImage, i) => {
if (links[i] && links[i].length > 0) {
linkedImage.style.cursor = "pointer";
linkedImage.href = links[i];
linkedImage.setAttribute('target','_blank');
}
});

});
</script>

Thanks