How can you count the number of items in the array - what do you have to add to this code?

<!DOCTYPE html>

<p>Click the button to sort the array.</p>

<button onclick="myFunction()">Try it</button>

<p id="demo"></p>

var fruits = ["Banana", "Orange", "Apple", "Mango"];
document.getElementById("demo").innerHTML = fruits;

function myFunction() {
document.getElementById("demo").innerHTML = fruits;


Many thanks

  1. 👍 0
  2. 👎 0
  3. 👁 63

Respond to this Question

First Name

Your Response

Similar Questions

  1. assembler language

    write an assembly language subordinate count according to these specs: accepts a pointer to an array or signed words in register X. Accepts a word value in register Y, which indicates the number of array elementsl Returns the

    asked by chris on January 12, 2013
  2. Math Statistics

    The sorting algorithm known as bogosort can be described in pseudocode as: while not isSorted(input): shuffle(input) If we feed bogosort a shuffled array of length n of unique items the distribution of the number of times

    asked by Nathan on February 23, 2013
  3. JavaScript

    I'm working on a javascript exercise. I have written function called count where the count function take in one parameter and the parameter is a array of number. The problem I having is how do i return the numbers of negative

    asked by Adam Johnson on November 15, 2011
  4. Math

    Tony broke a larger array into 2 x 9 array and a 4 x 9 array. What did the larger array look like? Draw picture. Write a number sentence to show the relationship between the large array and the two smaller arrays.

    asked by Cc on November 29, 2016
  5. math

    don break a 4x7 array into a 2x7 array and another array. what is the fact for dons second array? write a number sentence that models the relationship of the 4x7 array to the other two arrays.

    asked by stacey on January 8, 2013
  6. Math

    Don breaks a4 by 7array into a 2 by 7 array and another array. What is the fact for dons second array? Write a.number sentence that models the relationship of the 4 by 7 array to the other two arrays

    asked by Kolby knapp on January 2, 2013
  7. visual basic 2010

    I am totally lost with arrays. I have a program that needs to store users entries(first & last name...etc) in 2 different arrays. The summary button then loops through each array and outputs their contents to the immediate window.

    asked by melissa on September 18, 2011
  8. Programming Logic & Design

    Modify the previous process to store the scores in an array. You will need to use either parallel arrays or a two-dimensional array in order to store the score, slope and rating for each entry. In the loop you created in the

    asked by Julie on April 10, 2014
  9. computer science

    9.10: Reverse Array Write a function that accepts an int array and the array’s size as arguments. The function should create a copy of the array, except that the element values should be reversed in the copy. The function should

    asked by Cheryl on February 18, 2012
  10. math

    with each array write the factor pair. Rember that the # of row in the array are one factor and that the # of columns in the array is the other factor. Continue to build every possible array until you have all the possible factors

    asked by Elizabeth on August 29, 2012

More Similar Questions