DekGenius.com
Home
(current)
Dictionary
BOOKS
LYRICS
CHORD
SCRIPT & CODE EXAMPLE
Karaoke language
Search
Go
SCRIPT & CODE EXAMPLE
CODE EXAMPLE FOR JAVASCRIPT
how to get the first element in an array in javascript
var first = "role"; data.sort(function(x,y){ return x == first ? -1 : y == first ? 1 : 0; });
Source by stackoverflow.com #
PREVIOUS
NEXT
Tagged:
#element
#array
#javascript
ADD COMMENT
Topic
COMMENT
Name
7+4 =
Submit