string1.localeCompare(string2);
//returns postivie number if string1>string2
//returns negative number if string1<string2
//returns 0 if they are equivalent
employees.sort((a, b) => {
let fa = a.firstName.toLowerCase(),
fb = b.firstName.toLowerCase();
if (fa < fb) {
return -1;
}
if (fa > fb) {
return 1;
}
return 0;
});
Code language: JavaScript (javascript)
const num1 = 450;
const num2 = 350;
const num3 = 1000;
if (num1 > num2 && num1 > num3) {
console.log("num1 is bigger then num2 and num3");
} else if (num2 > num1 && num2 > num3) {
console.log("num2 is bigger num1 and num3");
} else {
console.log("num3 is bigger then num1 and num2");
}
//Output: num3 is bigger then num1 and num2