[Solved] IF statement have an issue. JavaScript


You need to call your function like: mojaFunkcija(); in order to execute it.
Also use other methods of inserting HTML content instead of document.write (which is bad practice).

var kripta = "sveta";
var vatra = "kralj";
var predstava = "odlicno";

function mojaFunkcija(){
    alert("Ja imam para!");
}

if ( (kripta=="sveta") && (vatra=="kralj") && (predstava=="odlicno")){
   document.body.innerHTML = "<p>Ja volim sebe</p>";
}else {
   mojaFunkcija();
}

solved IF statement have an issue. JavaScript