JavaScript Tutorial for Beginners – 13 – Function and if statement




Function and an if statement.

Original source


12 responses to “JavaScript Tutorial for Beginners – 13 – Function and if statement”

  1. Thanks EJ …Repeated several times until FcMadrid pays millions fine …VR

    function gameWinner(team, goal){
    if (goal > 3 && goal >0){
    alert ("Congrats!");
    document.write (team + " wins the Championship");
    }
    else if (goal <=3 && goal >=0){
    alert ("Badluck!");
    document.write(team + " will be banned ever");
    }
    else{
    alert ("Great Loss!");
    document.write(team + " will pay millions");
    }
    }
    gameWinner ("FcMadrid", 0);

  2. Any One Can Help me:….Wrap with a div

    As before, let's group all three pieces of supporting content with divs, like this:

    <div class="learn-more">
    <div class="container">
    <div>
    <h3>Travel</h3>

    </div>

    <div>
    <h3>Host</h3>

    </div>

    <div>
    <h3>Trust and Safety</h3>

    </div>
    </div>
    </div>

    How I will

    Wrap all pieces of supporting content with two divs, like in the example above. Give the outer div a class="learn-more" and the inner div a class="container".
    in this code:
    <!DOCTYPE html>
    <html>
    <body>
    <div class="nav">
    <div class="container">
    <div>
    <h3>Travel</h3>
    <p>"From apartments and rooms to treehouse."
    <p>
    <a href="#">"See how to travel on Airbni."
    </p>
    </div>

    <div>
    <h3>Host</h3>
    <p>"Renting out your unused space could pay your bills or fund your next vacation."</P>
    <p><a href="#">"Learn more about hosting"
    </div>
    <div>
    <h3>Trust and Safety</h3>
    <p> "From Verified ID to our worldwide customer support team, we've got your back."</p>
    <p><a href="#">"Learn about trust at Airbnb"
    </P>

    <h1>"Find a place to stay."</h1>
    <P>"Rent from people in over 34,000clients and 192 countries."
    </div>
    </div>
    </body>
    </html>

Leave a Reply