Is it possible to sort numbers or alphabets using any array helper like filter or map in ES6? [duplicate]












-2
















This question already has an answer here:




  • How to sort an array of integers correctly

    18 answers




const a = [1, 2, 3, 4, 5];



const b = [1, 2, 4, 5, 3];



const c = ['a', 'b', 'c', 'd', 'e'];



const d = ['a', 'c', 'b', 'd', 'e'];



I want to sort these but unable to do in ES6. Can you help me to understand?










share|improve this question















marked as duplicate by Bergi arrays
Users with the  arrays badge can single-handedly close arrays questions as duplicates and reopen them as needed.

StackExchange.ready(function() {
if (StackExchange.options.isMobile) return;

$('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');

$hover.hover(
function() {
$hover.showInfoMessage('', {
messageElement: $msg.clone().show(),
transient: false,
position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
dismissable: false,
relativeToBody: true
});
},
function() {
StackExchange.helpers.removeMessages();
}
);
});
});
Jan 20 at 14:19


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.














  • 2





    And what is wrong with Array.prototype.sort()? Please explain why this functionality won't solve your problem.

    – t.niese
    Jan 20 at 14:19


















-2
















This question already has an answer here:




  • How to sort an array of integers correctly

    18 answers




const a = [1, 2, 3, 4, 5];



const b = [1, 2, 4, 5, 3];



const c = ['a', 'b', 'c', 'd', 'e'];



const d = ['a', 'c', 'b', 'd', 'e'];



I want to sort these but unable to do in ES6. Can you help me to understand?










share|improve this question















marked as duplicate by Bergi arrays
Users with the  arrays badge can single-handedly close arrays questions as duplicates and reopen them as needed.

StackExchange.ready(function() {
if (StackExchange.options.isMobile) return;

$('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');

$hover.hover(
function() {
$hover.showInfoMessage('', {
messageElement: $msg.clone().show(),
transient: false,
position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
dismissable: false,
relativeToBody: true
});
},
function() {
StackExchange.helpers.removeMessages();
}
);
});
});
Jan 20 at 14:19


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.














  • 2





    And what is wrong with Array.prototype.sort()? Please explain why this functionality won't solve your problem.

    – t.niese
    Jan 20 at 14:19
















-2












-2








-2









This question already has an answer here:




  • How to sort an array of integers correctly

    18 answers




const a = [1, 2, 3, 4, 5];



const b = [1, 2, 4, 5, 3];



const c = ['a', 'b', 'c', 'd', 'e'];



const d = ['a', 'c', 'b', 'd', 'e'];



I want to sort these but unable to do in ES6. Can you help me to understand?










share|improve this question

















This question already has an answer here:




  • How to sort an array of integers correctly

    18 answers




const a = [1, 2, 3, 4, 5];



const b = [1, 2, 4, 5, 3];



const c = ['a', 'b', 'c', 'd', 'e'];



const d = ['a', 'c', 'b', 'd', 'e'];



I want to sort these but unable to do in ES6. Can you help me to understand?





This question already has an answer here:




  • How to sort an array of integers correctly

    18 answers








javascript arrays sorting






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Jan 20 at 14:18









Bergi

371k58552881




371k58552881










asked Jan 20 at 14:15









My DaysMy Days

95




95




marked as duplicate by Bergi arrays
Users with the  arrays badge can single-handedly close arrays questions as duplicates and reopen them as needed.

StackExchange.ready(function() {
if (StackExchange.options.isMobile) return;

$('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');

$hover.hover(
function() {
$hover.showInfoMessage('', {
messageElement: $msg.clone().show(),
transient: false,
position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
dismissable: false,
relativeToBody: true
});
},
function() {
StackExchange.helpers.removeMessages();
}
);
});
});
Jan 20 at 14:19


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.









marked as duplicate by Bergi arrays
Users with the  arrays badge can single-handedly close arrays questions as duplicates and reopen them as needed.

StackExchange.ready(function() {
if (StackExchange.options.isMobile) return;

$('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');

$hover.hover(
function() {
$hover.showInfoMessage('', {
messageElement: $msg.clone().show(),
transient: false,
position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
dismissable: false,
relativeToBody: true
});
},
function() {
StackExchange.helpers.removeMessages();
}
);
});
});
Jan 20 at 14:19


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.










  • 2





    And what is wrong with Array.prototype.sort()? Please explain why this functionality won't solve your problem.

    – t.niese
    Jan 20 at 14:19
















  • 2





    And what is wrong with Array.prototype.sort()? Please explain why this functionality won't solve your problem.

    – t.niese
    Jan 20 at 14:19










2




2





And what is wrong with Array.prototype.sort()? Please explain why this functionality won't solve your problem.

– t.niese
Jan 20 at 14:19







And what is wrong with Array.prototype.sort()? Please explain why this functionality won't solve your problem.

– t.niese
Jan 20 at 14:19














1 Answer
1






active

oldest

votes


















0














Just use the sort() function. For example a.sort()






share|improve this answer






























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    0














    Just use the sort() function. For example a.sort()






    share|improve this answer




























      0














      Just use the sort() function. For example a.sort()






      share|improve this answer


























        0












        0








        0







        Just use the sort() function. For example a.sort()






        share|improve this answer













        Just use the sort() function. For example a.sort()







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Jan 20 at 14:17









        Imre_GImre_G

        912720




        912720

















            Popular posts from this blog

            How fix org.hibernate.TransientPropertyValueException

            Updating UILabel text programmatically using a function

            Cloud Functions - OpenCV Videocapture Read method fails for larger files from cloud storage