function ordenar(string){
var abc = 'abcdefghijklmnopqrstuvwxyz',
to = abc.split(''),
str = string.split('');
for(let i=0;i<to.length;i++){
for(let j=0;j<str.length;j++){
if(str[j] == to[i]) console.log(to[i]);
}
}
}
ordenar('hola');
As you can see in the console it shows ahlo
, but I want it to show how it was originally hola
, what is the error or how should it be done?