diff --git a/index.html b/index.html index 8f536de8..9dc72874 100644 --- a/index.html +++ b/index.html @@ -2,14 +2,16 @@ - + Pig latin App + -

Hello World!

-
-
- -
+
+

Pig Latin

+ + + +
diff --git a/main.html b/main.html new file mode 100644 index 00000000..e69de29b diff --git a/main.js b/main.js index 1c92f304..977d67af 100644 --- a/main.js +++ b/main.js @@ -1,5 +1,5 @@ 'use strict'; - +const word = document.querySelector("text") // brings in the assert module for unit testing const assert = require('assert'); // brings in the readline module to access the command line @@ -14,8 +14,26 @@ const rl = readline.createInterface({ const pigLatin = (word) => { // Your code here + let vowels = "aeiou".split(""); + + for(let i = 0; i < word.length; i +=1) { + let letter = word[i]; + if (vowels.indexOf(letter) != -1 && i === 0) + { + return word + "way"; } + if (vowels.indexOf(letter) != -1) { + return word.slice(i) + word.slice(0, i) + "ay"; + } +} + return word + "ay"; + +} + +let result = Piglatin("pimple"); +console.log(result); + // the first function called in the program to get an input from the user // to run the function use the command: node main.js diff --git a/styles.css b/styles.css new file mode 100644 index 00000000..c9672b0b --- /dev/null +++ b/styles.css @@ -0,0 +1,55 @@ +*{ + padding: 0; + margin: 0; + box-sizing: border-box; +} + +body{ + position: relative; + background-color: blue; + justify-content: center; + align-items: center; + margin: auto; +} + +.section{ + height: 400px; + font-size: 30px; + position: relative; + margin: auto; + justify-content: center; + align-items: center; +} + +.section h1 { + position: absolute; + margin: 0; + top: 30%; + left: 54%; + transform: translate(-50%, -50%); + height: 40px; +} +.section input{ + position: absolute; + margin: 0; + top: 50%; + left: 50%; + transform: translate(-50%, -50%); + height: 30px; + font-size: 15px; +} + +.section .input-btn{ + position: absolute; + margin: 0; + top: 50%; + left: 63%; + transform: translate(-50%, -50%); + height: 35px; + width: 8%; + font-size: 15px; +} + +.input-btn:hover{ + background-color: red; +} \ No newline at end of file