Given two Strings, return 1 if the first is higher in alphabetical order than
the second, return -1 if the second is higher in alphabetical order than the
first, and return 0 if they’re equal
This is my attempt: it must be within the function sortAscending…
function sortAscending(stringOne, stringTwo) {
var alphabet = [a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z];
for (var i = 0; i<= alphabet.length-1; i++){
if (stringOne[0] > stringTwo[0]){
return 1;
} else if (stringOne[0] < stringTwo[0]){
return -1;
} else if (stringOne[0] === stringTwo[0]){
return 0;
}
Let me know if anyone has any insight!