Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,16 @@
<html>
<head>
<meta charset="utf-8">
<title></title>
<title>Pig latin App</title>
<link rel="stylesheet" href="styles.css">
<script src="main.js"></script>
</head>
<body>
<h1>Hello World!</h1>
<hr/>
<div id="display-element"></div>
<button onclick="displayDate()">Click Me</button>
<hr/>
<div class="section" id="title">
<h1>Pig Latin</h1>
<input type="text">
<button type="submit" class="input-btn" id="input-button">translation</button>

</div>
</body>
</html>
Empty file added main.html
Empty file.
20 changes: 19 additions & 1 deletion main.js
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
Expand Down
55 changes: 55 additions & 0 deletions styles.css
Original file line number Diff line number Diff line change
@@ -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;
}