Как отсортировать массив массивов в порядке возрастания

Вот способ доступа: свойства after и: before style, определенные в css:

// Get the color value of .element:before
var color = window.getComputedStyle(
    document.querySelector('.element'), ':before'
).getPropertyValue('color');

// Get the content value of .element:before
var content = window.getComputedStyle(
    document.querySelector('.element'), ':before'
).getPropertyValue('content');
0
задан sawa 28 March 2019 в 09:46
поделиться

1 ответ

Просто используйте Array#sort с блоком

golf.sort { |x, y| x[1] <=> y[1] }
=> [["ScoreH", 1], ["ScoreB", 3], ["ScoreD", 4], ["ScoreF", 9], ["ScoreA", 10], ["ScoreJ", 23], ["ScoreG", 45], ["ScoreC", 67], ["ScoreI", 87], ["ScoreE", 88]]
0
ответ дан Ajay Barot 28 March 2019 в 09:46
поделиться
Другие вопросы по тегам:

Похожие вопросы: