1234567891011121314151617181920212223 |
- <header>
- <h1>Credentials</h1>
- </header>
- <body>
- <script>
- const capitalize = str => {
- str = str.toLowerCase().trim();
- let result = str[0].toUpperCase() + str.slice(1);
- return result;
- }
- const credentials = () => {
- let sName = capitalize(prompt("Enter surname"));
- let name = capitalize(prompt("Enter name"));
- let fatherName = capitalize(prompt("Enter father name"));
- let fullName = sName + ' ' + name + ' ' + fatherName;
- return { name, sName, fatherName, fullName };
- }
- let res = credentials();
- alert(res.name + "\n" + res.sName + "\n" + res.fatherName + "\n" + res.fullName);
- </script>
- </body>
|