Lecture 29

 Index.html

<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>

</head>

<body>

    <center>
        <button onclick="sum()">
            Sum
        </button>

    </center>

    <script src="js/script.js"></script>

</body>

</html>

script.js



// let a = prompt("You have to enter something", "hello Bilal")


// console.log(a)

function sum() {

    let a = prompt("enter first value")
    let b = prompt("enter second value")


    let result = parseInt(a) + parseInt(b)

    // let a = "20"
    // let b = "40"

    console.log(result);
}



// let firstName = "Muhammmad"

// let lastName = "Lucky"



// alert("hello " + firstName + " your last name is " + lastName)

Comments