All Questions
60 questions
1
vote
1
answer
43
views
How do I sort specific elements in list in javascript?
In javascript, I want to sort specific elements which are represented by variables in list in automatic way.
const PHQ = [
{
q: '1',
a: [
{ answer: '1', type: ['a']},
{ answer: '...
0
votes
1
answer
908
views
Drag and Drop Issue in JavaScript Sortable List
Goodday all, This is my first question here:
I'm currently working on a web application that involves drag-and-drop sorting of items within separate lists. I have two distinct lists: a left list and a ...
0
votes
1
answer
36
views
Find closest array given list of arrays [closed]
Given a list of arrays in a variable, how can I find the index from the most closest array to the main array that I have? I need a function that does this by the numerical values of each index of the ...
-1
votes
1
answer
265
views
Sort HTML list by class content
I have a list of books in HTML, which contains multiple elements:
The book's title
The author's name
Whether the book is finished or not (Completed / Ongoing)
The book's synopsis
I am trying to make ...
3
votes
2
answers
484
views
Is there a way to display the contents of an array as an ordered list but inside of a alert box
I am writing a program which asks for input through text boxes and then asks for more items through prompts. I am using the .push method to add the inputs to the empty array I have. At the end of the ...
0
votes
1
answer
46
views
Links not changed after alphabetically sorting
I have a list that is sorted alphabetically, but links from each li are not changing if I verify the elements links after sorting. Can't figure out what am I missing.
Any help with explanations would ...
2
votes
0
answers
882
views
List.js how to reset sorting to initial state
I'm currently working with the list.js library and its sorting method. The functionality works perfectly when you want to sort asc or desc, but is there a way to reset everything to initial state from ...
2
votes
3
answers
4k
views
How to sort an array of object by a specific field Javascript
I have an array containing multiple objects with multiple fields, and I'm trying to sort the array in decending order from the largest "Views" value to the lowest. but when I run my code it ...
0
votes
2
answers
4k
views
How do I sort html list alphabetically using javascript on page load
I have an unordered list on my page. I will be adding more names to it continuously, so I want the list to be sorted alphabetically on page load.
Here is what I have done so far but it is not working.
...
0
votes
2
answers
294
views
Sorting and unsorting function
I made script for sorting (A to Z)
My question is what I need to add to this to have unsort function, I mean set to default (how it was before you sort them).
Code:
function sortList() {
document....
0
votes
3
answers
180
views
How can I filter out the similar attribute names in an array in Javascript?
I'm doing a project where I'm pulling data from an API, and it's all going well so far but I can't seem to figure out how to filter out the ingredients and measurements specifically.
The array looks ...
1
vote
1
answer
785
views
Filter list of objects based on property of objects in another list
I have a list of objects:
let data = [{... , user: "user 1"}, {... , user: "user 1"}, {... , user: "user 1"}, {... , user: "user 2"}, {... , user: "user 2&...
0
votes
2
answers
84
views
How to transform Javascript object with groupby and reduce properly?
I need to transform following object
[
{
"name" : "sazzad",
"type" : "credit",
"amount" : 10
},{
...
-1
votes
2
answers
80
views
Javascript sort list works only onve
I'm trying to implement a question like system.
The questions should reorder with every like based on the data attribute 'vote'.
So every time a like event is received from the sockets the sort ...
0
votes
2
answers
115
views
Loop multiple lists based on their length [closed]
In my code I have 6 lists of objects of different sizes.
I need to go through them all in a specific order, from the smallest list to the largest.
var list_1 = [...] // length 24
var list_2 = [...] ...