Pluralizer
How do I make an pluralizer?
What is a pluralizer? How do you make a pluralizer? This script and codes were developed by Anthony Keithley on 24 December 2022, Saturday.
Pluralizer - Script Codes HTML Codes
<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>Pluralizer</title> <link rel="stylesheet" href="css/style.css">
</head>
<body> <div id="container">
<img src="https://s16.postimg.org/75cwpze91/plural.jpg">
<h2>Please enter a word:</h2>
<input id="input" type="text" label="word" id="word" onkeydown="enterKey()"></input>
<button class="button1" id="btn" onclick="plur()">PLURALIZE!</button>
<p>Plural: <span id="result"></span></p>
</div> <script src="js/index.js"></script>
</body>
</html>
Pluralizer - Script Codes CSS Codes
h1 { color: blue;
}
.button1 { background: blue; color: white; box-shadow: 0 8px 16px 0 rgba(0,0,0,0.2), 0 6px 20px 0 rgba(0,0,0,0.19);
}
.button1:hover { box-shadow: 0 12px 16px 0 rgba(0,0,0,0.24), 0 17px 50px 0 rgba(0,0,0,0.19);
}
#container { width: 600px; margin: 0 auto; text-align: center;
}
#input {
}
img { border: 50px solid rgba(255, 0, 0, .3);; z-index:999;
}
Pluralizer - Script Codes JS Codes
function enterKey(){ if(event.keyCode == 13){ document.getElementById("btn").click(); }
}
function plur(){ var word = document.getElementById("input").value.toLowerCase(); //last letter var last = word.charAt(word.length - 1); //second to last letter var secToLast = word.charAt(word.length - 2); //last two letters var lastTwo = word.substring(word.length - 2); //all but the last letter of the word ex: Brush --> brus var allButLast = word.substring(0, word.length - 1); //Output var result = word + "s"; //Words that get 'es' when plural if(word.substring(word.length - 2) == "ch" || word.substring(word.length - 2) == "sh" || last == "s" || last == "x" || last == "z"){ if(word == "ox"){ result = "oxen"; } else { result = word + "es"; } } //End in single z if(last == "z"){ if(secToLast != "z"){ result = word + "zes"; } } //Words that end in o if(last == "o"){ if(isVowel(secToLast)){ result = word + "s"; } else { result = word + "es"; } } //Words that end in f if(last == "f"){ if (secToLast != "l"){ result = word + "s"; } else { result = allButLast + "ves"; } } //Words that end in fe if(word.substring(word.length - 2) == "fe"){ result = word.substring(0, word.length - 2) + "ves"; } //Words that end in y if(last == "y" && !isVowel(secToLast)){ result = allButLast + "ies"; } //Special words if(word == "index"){ result = "indices"; } if (word == "moose"){ result = "moosen"; } if(word == "child"){ result = "children"; } if(word == "person"){ result = "people"; } if(word == "man"){ result = "men"; } if(word == "woman"){ result = "women"; } if(word == "goose"){ result = "geese"; } if(word == "deer" || word == "buffalo" || word == "aircraft" || word == "fish" || word == "offspring" || word == "sheep" || word == "species" || word == "trout" || word == "salmon"){ result = word; } if(word == "mouse"){ result = "mice"; }
document.getElementById("result").innerHTML = result;
}
//returns true if char is a vowel, false if it is a consonant
function isVowel(char){ if (char == "a" || char == "e" || char == "i" || char == "o" || char == "u"){ return true; } else { return false; }
}
Developer | Anthony Keithley |
Username | KeithleySLHS |
Uploaded | December 24, 2022 |
Rating | 3 |
Size | 2,576 Kb |
Views | 4,048 |
Find the perfect freelance services for your business! Fiverr's mission is to change how the world works together. Fiverr connects businesses with freelancers offering digital services in 500+ categories. Find Developer!
Name | Size |
Input and Output Test | 1,714 Kb |
Portfolio | 3,748 Kb |
SystemsSolver | 1,948 Kb |
CSS3 | 1,849 Kb |
Dashboard | 2,803 Kb |
My Interests | 1,996 Kb |
GetRekt | 2,206 Kb |
Organizing Your HTML | 1,676 Kb |
Padding and Margin | 0 Kb |
Animations | 1,595 Kb |
Jasper is the AI Content Generator that helps you and your team break through creative blocks to create amazing, original content 10X faster. Discover all the ways the Jasper AI Content Platform can help streamline your creative workflows. Start For Free!
Name | Username | Size |
Off Canvas | Mariamarica | 1,870 Kb |
E-mail Template | SoloMDFK | 4,871 Kb |
JQuery Validate checkbox group | Lunaman | 2,466 Kb |
GrcJS | Vino6 | 2,047 Kb |
Canvas snow | Win7killer | 2,572 Kb |
CSS background-size - GSAP | Jonathan | 2,209 Kb |
Click Based Rotation Demo | Zeaklous | 2,086 Kb |
Simple star rating using js and data-uri | TheEnd | 5,795 Kb |
Calculator - codevember 08 - 2016 | Caiocares | 3,260 Kb |
Simple Weather App | Cmwebby | 0 Kb |
Surf anonymously, prevent hackers from acquiring your IP address, send anonymous email, and encrypt your Internet connection. High speed, ultra secure, and easy to use. Instant setup. Hide Your IP Now!