switchbutton.addEventListener("click",function(){
if(toggle == 0) {
document.querySelector(".text").innerHTML = "zamena";
toggle = 1;
} else {
document.querySelector(".text").innerHTML = "test";
toggle = 0;
}
});
() => {
const replacedText = toggle ? text1 : text2;
toggle = !toggle;
document.querySelector(anySelector).innerHtml = replacedText;
}