Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

sort object with certain value at start of array js

objs.sort((a,b) => {
 	if (a.value == "your value") return parseInt("-" + objs.indexOf(a)) // moves up based on its index
})
 
PREVIOUS NEXT
Tagged: #sort #object #start #array #js
ADD COMMENT
Topic
Name
8+2 =