Q.2 of Assignment 6 in javascript

Can You help me with question 2 of assignment 6 I don’t know how to put value in p

p{ display: none; }
<h1>Dar se Mat Dar</H1>

    <p class="age">1. You are </p>

    <p class="age">2. You are </p>

    <p class="age">3. You are</p>

    <p class="age">4. You are</p>

    <p class="age">5. You are</p>

 <script>  

        var x = prompt("Enter Your age : ");

        var b = document.getElementsByClassName("age");

            for (value of b){

                document.writeln(value.innerText +" "+ x + " years old" + "<br>");

            }

 </script>
1 Like