谁能告诉我如何存储10个分数并使用本地存储在一行中显示一个分数?

时间:2016-03-07 05:14:52

标签: javascript

有人能告诉我如何存储10个分数并使用本地存储在一行中显示一个分数吗?

var score = new Array(10);
var highscore = new Array();
var len = score.length;

function f_score() {
    for (i = 0; i < len; i++) {
      for (j = 0; j < len; j++) {
        if (score[j] < score[j + 1]) {
          temp = score[i];
          score[i] = score[i + 1];
          score[i + 1] = temp;
        }
        localstorage.setItem("highscore", score);
        var highscore = localstorage.getitem("highscore");
      }
    }
    document.write(highscore + "<br>")

0 个答案:

没有答案