Reputation: 33
Hi i have to create a function that recognizes names- Polish names. Its quiet easy, bc 99% of female names ends with "a", where mens not, the only man name who ends with "a" is a “Bonawentura”. So to i tried create function that tooks in record that the names with "a" are female exception to “Bonawentura”. So the function will work that if its a female name = false, if man = true f.e input:
“Ala”, “Jacek”, “Bonawentura”
and output:
false, true, true
that what i tried:
function isMaleName() {
if ( str.endsWith("a") = false)
}
Cheers, and appriciate any help/tips. Have a nice day.
Upvotes: 0
Views: 89
Reputation: 386654
You coulf check for endig or exceptional name.
function isMaleName(string) {
return !string.endsWith("a") || string === 'Bonawentura';
}
console.log(['Ala', 'Jacek', 'Bonawentura'].map(isMaleName));
Upvotes: 1