📅  最后修改于: 2022-03-11 15:03:30.153000             🧑  作者: Mango
/* Test if a character is uppercase by converting it to lowercase
* and comparing that with the original.
* If they are different, the original was uppercase.
* If they are the same, the original was either a lowercase character
* or a character that doesn't have uppercase and lowercase
* versions (e.g. a number or punctuation mark).
*/
function isUpperCase(char)
{
// 'char' is a string containing a single character
return char !== char.toLowerCase();
}