Community

    • Login
    • Search
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search

    HOw to add count function to keep the amount of objects in my array while also using the alphabeticall function

    Help wanted · · · – – – · · ·
    2
    2
    1175
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Matthew PELLING
      Matthew PELLING last edited by

      <html>
      <body>

      <p>The sort() method sorts an array alphabetically.</p>

      <button onclick=“myFunction()”>Try it</button>

      <p id=“demo”></p>

      <script>
      var fruits = [“Banana”, “Orange”, “Apple”, “Mango”];
      document.getElementById(“demo”).innerHTML = fruits;

      function myFunction() {
      fruits.sort();
      document.getElementById(“demo”).innerHTML = fruits;
      }
      </script>

      </body>
      </html>

      1 Reply Last reply Reply Quote 0
      • MAPJe71
        MAPJe71 last edited by

        This is not a Notepad++ related question. Try a community or a message board related to JavaScript or simply Google for it, there’s tons of information out there.

        1 Reply Last reply Reply Quote 2
        • First post
          Last post
        Copyright © 2014 NodeBB Forums | Contributors