skip to Main Content

check all checkbox by class name – Javascript

I´m trying to check and unchex all check boxes with javascript and vue. const checkAll = () => { var array = document.getElementsByClassName("assign_register"); for(var i = 0; i < array.length; i++){ if(array[i].type == "checkbox"){ if(array[i].className == "assign_register"){ array[i].checked = true;…

VIEW QUESTION

Simple way to sort 2d array in Javascript?

I have a 2d array like this: [[0,23],[19,30],[6,47],[5,59],[1,56],[1,20],[19,10]] How can I sort that based on the value of pairs like this: [[0,23],[1,20],[1,56],[5,59],[6,47],[19,10],[19,30]] Here is my attempt: let arr = [[0,23],[19,30],[6,47],[5,59],[1,56],[1,20],[19,10]]; let result = arr .map(a => `${a[0]}.${a[1]}`) .sort() .map(a =>…

VIEW QUESTION
Back To Top
Search