Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var data = [
- { count: 'phone', year: '1956' },
- { count: 'phone', year: '1971' },
- { count: 'text', year: '1989' },
- { count: '33', year: '1932' },
- { count: '33', year: '1912' },
- { count: 'text', year: '1954' },
- { count: 'phone', year: '1920' },
- { count: '33', year: '3444' }
- ];
- data.sort(function(a,b){
- return a['count']<b['count']?-1:(a['count']>b['count']?1:(a['year']<b['year']?-1:1));
- });
- var i;
- for (i = 0; i < data.length; i++) {
- document.write("<p>count:" + data[i].count +
- " year:" + data[i].year + "</p>");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement