Display elements of an array with intervals one at the time

Mare Gaea

This is somewhat of a hypothetical question as it is something I have been breaking my head about whether it's possible or not (either in php or in java-script or any other way):

Suppose I have an array of 1,2,3,4,5,6,7,8,9,0.

In the situation I am thinking about I was wondering whether it's possible to display them in a list visually building up like this:

1 (1 second interval)
2 (1 second interval)
3 (1 second interval)
...and so on until the full list of all ten items is displayed after 10-11 seconds.

This is actually a pure theoretical question as I am not currently struggling with it while coding, hence I am not including any code-examples.

I was just wondering, philosophizing if you like, whether this is possible instead of showing the whole array all at once? To be honest, I've never come across anything that said it was possible. Thanks a million!

The Process

You should at least post what you have tried so far, here is some basic example

var arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 0];
var elem = document.getElementById('pr');

function print(array, el) {
  var i = 0;
  var func = setInterval(function() {
    el.innerHTML += '<br>' + array[i];
    i++;
    if (i >= array.length) {
      clearInterval(func);
    }

  }, 1000);

}

print(arr, elem);
<div id="pr">

</div>

이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.

침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제

에서 수정
0

몇 마디 만하겠습니다

0리뷰
로그인참여 후 검토

관련 기사

분류에서Dev

Use a button to display one array string at a time in Javascript

분류에서Dev

PHP time intervals

분류에서Dev

Perl Checking if a scalar contains one of the elements in an array

분류에서Dev

Checking if time is between two intervals

분류에서Dev

How to count the elements in array which are more than one (php)

분류에서Dev

Group Pandas dataframe data in time intervals

분류에서Dev

Selecting regular intervals from time series

분류에서Dev

Node.js - Looping through array of URLS one at a time

분류에서Dev

Array Fetching time one row value is skipping by code

분류에서Dev

3 elements in a div element can't display in one line Jquery Mobile

분류에서Dev

How to map one array element which is separated by newlines into a new array with multiple elements

분류에서Dev

Display file text one page at a time, wait 20 seconds, then auto-advance

분류에서Dev

How to retrieve data from SQLite and display in TextView only one at a time when clicked on button

분류에서Dev

Iterating through a JSON object and display results in regular intervals

분류에서Dev

Optimal way to group time intervals based on projected points

분류에서Dev

How can I automatically invoke a servlet periodically at specified time intervals

분류에서Dev

Can RAM data remain alive over small intervals of time

분류에서Dev

Display time difference - Formatting

분류에서Dev

How can I capitalize a letter from a word one at a time, then add each instance of the word with a caps letter into a array?

분류에서Dev

How to calculate one hour ago time from an string array in java which holds value from database

분류에서Dev

Unhide one column at a time

분류에서Dev

Array map skipping elements

분류에서Dev

Accesing array elements in logstash

분류에서Dev

Accesing array elements in logstash

분류에서Dev

List of Elements to Boolean Array

분류에서Dev

Join Array elements

분류에서Dev

Iterate array elements in <li>

분류에서Dev

List of Elements to Boolean Array

분류에서Dev

cannot display time selector correctly?

Related 관련 기사

  1. 1

    Use a button to display one array string at a time in Javascript

  2. 2

    PHP time intervals

  3. 3

    Perl Checking if a scalar contains one of the elements in an array

  4. 4

    Checking if time is between two intervals

  5. 5

    How to count the elements in array which are more than one (php)

  6. 6

    Group Pandas dataframe data in time intervals

  7. 7

    Selecting regular intervals from time series

  8. 8

    Node.js - Looping through array of URLS one at a time

  9. 9

    Array Fetching time one row value is skipping by code

  10. 10

    3 elements in a div element can't display in one line Jquery Mobile

  11. 11

    How to map one array element which is separated by newlines into a new array with multiple elements

  12. 12

    Display file text one page at a time, wait 20 seconds, then auto-advance

  13. 13

    How to retrieve data from SQLite and display in TextView only one at a time when clicked on button

  14. 14

    Iterating through a JSON object and display results in regular intervals

  15. 15

    Optimal way to group time intervals based on projected points

  16. 16

    How can I automatically invoke a servlet periodically at specified time intervals

  17. 17

    Can RAM data remain alive over small intervals of time

  18. 18

    Display time difference - Formatting

  19. 19

    How can I capitalize a letter from a word one at a time, then add each instance of the word with a caps letter into a array?

  20. 20

    How to calculate one hour ago time from an string array in java which holds value from database

  21. 21

    Unhide one column at a time

  22. 22

    Array map skipping elements

  23. 23

    Accesing array elements in logstash

  24. 24

    Accesing array elements in logstash

  25. 25

    List of Elements to Boolean Array

  26. 26

    Join Array elements

  27. 27

    Iterate array elements in <li>

  28. 28

    List of Elements to Boolean Array

  29. 29

    cannot display time selector correctly?

뜨겁다태그

보관