VIDEO 38 PART 1

PHOTO EMBED

Tue Jan 07 2025 14:22:05 GMT+0000 (Coordinated Universal Time)

Saved by @E23CSEU1151

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <h1> CHAI OR CODE </h1>
    <button id = "stop ">stop </button>
</body>
<script>

////////////////////***** 1 WAY ***//////////////
    setTimeout(function(){
        consol.log("HITESH"); ///after 2 sec it will excute 
    },2000) // only 1 time will excute 

////////////////////***** 2 WAY ***//////////////

    const sayhitesh = function (){
        console.log("tanishq");
    }
const changeText = function () {
  document.querySelector('h1').innerHTML = "best js course on yt"; // change the h1   
};

const changeMe = setTimeout(changeText, 2000); // changeText will execute after 2 seconds

document.querySelector('#stop'). //// function to stop the changetext option 
addEventListener('click', function () { // if we press stop button it will stop the excution of changing of h1 
    clearTimeout(changeMe)
    console.log("STOPPED")
})

</script>
</html>
content_copyCOPY