Wie finde ich heraus ob Javascript wirklich funktioniert?
ich habe ein paar dinge in javascript versucht aber bin mir sehr unsicher ob es wirklich und sicher funktioniert, wie könnte ich überprüfen ob es zu 100% funktioniert?
var timeInterval;
function startUpdatingTime() {
clearInterval(timeInterval);
timeInterval = setInterval(updateTime, 120000);
displayTimeSetting();
}
function stopUpdatingTime() {
clearInterval(timeInterval);
displayTimeSetting();
}
function doubleUpdateTime() {
clearInterval(timeInterval);
updateTime();
timeInterval = setInterval(updateTime, 60000);
displayTimeSetting();
}
function updateTime() {
var xhr = new XMLHttpRequest();
xhr.onreadystatechange = function() {
if (xhr.readyState === XMLHttpRequest.DONE) {
if (xhr.status === 200) {
var age = xhr.responseText;
document.getElementById("antwort").textContent = "Antwort: " + antwort;
} else {
console.error('Es gab ein Problem mit der Anfrage.');
}
}
};
xhr.open("GET", "update_time.php", true);
}
startUpdatingTime();