Jump to content

gustavon

Members
  • Posts

    1
  • Joined

  • Last visited

Posts posted by gustavon

  1. I have this script and would like to make it search if just the word Mango is in the array and if it is true console.log the index of it. 

    <!DOCTYPE html>
    <html>
    <body>
    <h1>Array includes()</h1>
    <p>Check if the fruit array contains "Mango":</p>
    <p id="demo"></p>
    <p><strong>Note:</strong> The includes method is not supported in Edge 13 (and earlier versions).</p>
    <script>
    var fruits = ["Banana is yellow", "Orange juice", "Apple is red", "Mango is orange"];
    var n = fruits.includes("Mango");
    console.log(n);
    </script>
    </body>
    </html>

     

×
×
  • Create New...