function possibleChanges(usernames) {
// Write your code here
let verify;
let verified = [];
let results = [];
usernames.forEach((username) => {
for (let i = 1; i < username.length; i++) {
const firstChar = username.charAt(0);
const ver = firstChar.localeCompare(username.charAt(i));
if (ver === 1) {
verify = true;
verified.push(verify);
} else if (ver === 0) {
verify = false;
verified.push(verify);
} else if (ver === -1) {
verify = false;
verified.push(verify);
}
}
if (verified.includes(true)) {
results.push('YES');
} else {
results.push('NO');
}
verified = [];
});
return results;
}
console.log(
possibleChanges(['ali', 'afa', 'kral', 'xxxxxxxx', 'kara', 'a', 'cebl']),
);