Thursday, May 26, 2022

The other test your skills n.3-strings - Mozilla

 

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8"/>
    <title>Strings: Task 3</title>
    <style>
      p {
        color: purple;
        margin: 0.5em 0;
      }

      * {
        box-sizing: border-box;
      }
    </style>
    <link rel="stylesheet" href="../styles.css" />
  </head>

  <body>

    <section class="preview">



    </section>

  </body>
  <script>
    // alert(1);
    const quote = 'I dO nOT lIke gREen eGgS anD HAM';

    // Add your code here
    const fixedQuote1 = quote.toLowerCase();
    // alert(fixedQuote1)
    const fixedQuote = fixedQuote1.replace(fixedQuote1[0] , quote.toLocaleUpperCase()[0])
    // alert(fixedQuote);
    const finalQuote = fixedQuote.replace('green eggs and ham', 'papaya and milk vitamin');
    // Don't edit the code below here!

    const section = document.querySelector('section');

    const para1 = document.createElement('p');
    para1.textContent = fixedQuote;
    const para2 = document.createElement('p');
    para2.textContent = finalQuote;

    section.appendChild(para1);
    section.appendChild(para2);

</script>

</html>

Rute Bezerra de Menezes Gondim



No comments:

Post a Comment