Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function solve() {
- let library = {
- 'Camel Case': function (input) {
- return input.map((e, i) => {
- if (i === 0) {
- return e.toLowerCase();
- } else {
- let result = e[0].toUpperCase() + e.slice(1).toLowerCase();
- return result;
- }
- }).join('');
- },
- 'Pascal Case': function (input) {
- return input.map(e => e[0].toUpperCase() + e.slice(1).toLowerCase()).join('');
- }
- };
- let textTokens = document.getElementById('text').value.split(' ');
- let namingCase = document.getElementById('naming-convention').value;
- if(library[namingCase]){
- document.getElementById('result').textContent = library[namingCase](textTokens);
- } else {
- document.getElementById('result').textContent = 'Error!';
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement