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
162 changes: 155 additions & 7 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,32 +16,180 @@ <h2>1. String Mirror</h2>

<input id="mirror-input" type="text" placeholder="Enter your string here">
<p id="mirror-output">Waiting for input...</p>
<button id="mirror-button" type="submit">Submit</button>
<button onclick = "displayUserInput()" id="mirror-button" type="submit">Submit</button>

<script>
const displayUserInput = () =>{
let mirrorInput = document.getElementById("mirror-input");
let mirrorInputValue = mirrorInput.value;
let mirrorOutput = document.getElementById("mirror-output");
mirrorOutput.textContent = mirrorInputValue
}
</script>


<h2>2. String Uppercaser</h2>

<li>Make a text input with id='uppercaser-input'</li>
<li>They should then be able to click a "submit" button with id='uppercaser-button' that will display the string the user entered in all uppercase in an element with id='uppercaser-output'</li>
<li>They should then be abble to click a "submit" button with id='uppercaser-button' that will display the string the user entered in all uppercase in an element with id='uppercaser-output'</li><br>

<input id="uppercaser-input" type="text" placeholder="Enter your string here">
<p id="uppercaser-output">Waiting for input...</p>
<button onclick="turnUpperCase()" id="uppercaser-button" type="submit">Submit</button>

<script>
const turnUpperCase = () =>{
let uppercaserInput = document.getElementById("uppercaser-input");
let uppercaserValue = uppercaserInput.value;
let uppercaserOutput = document.getElementById("uppercaser-output");
uppercaserOutput.textContent = uppercaserValue.toUpperCase();
}

</script>

<h2>3. Palindrome Detector</h2>

<li>The user should be able to enter a string into a text input with id='palindrome-input'</li>
<li>They should then be able to click a "submit" button with id='palindrome-button'. Clicking the button will display a string in the form "It is ${true/false} that ${entered string} is a palindrome" with id='palindrome-output'</li>
<li>They should then be able to click a "submit" button with id='palindrome-button'. Clicking the button will display a string in the form "It is ${true/false} that ${entered string} is a palindrome" with id='palindrome-output'</li><br>

<input id="palindrome-input" type="text" placeholder="Enter a string">
<p id="palindrome-output">Waiting for input...</p>
<button onclick= "palindromeDetector()" id="palindrome-button" type="submit">Submit</button>

<script>

const palindromeDetector = () =>{
let originalInput = document.getElementById("palindrome-input").value;
let remove = /[\W_]/g;
let changeStr = originalInput.toLowerCase().replace(remove, '');
let reverseStr = changeStr.split('').reverse().join('');
let palindromeOutput = document.getElementById("palindrome-output");
let palindromeOrNah = (reverseStr === changeStr);
palindromeOutput.textContent = `It is ${palindromeOrNah} that ${originalInput} is a palindrome`;
}

</script>

<!-- function palindrome(str) {
var re = /[\W_]/g;
var lowRegStr = str.toLowerCase().replace(re, '');
var reverseStr = lowRegStr.split('').reverse().join('');
return reverseStr === lowRegStr;
}
palindrome("A man, a plan, a canal. Panama"); -->

<!--
// Clicking the button will display a string in the form:
//"It is ${true/false} that ${entered string} is a palindrome" with id='palindrome-output'

// const palindromeDetector = () =>{
// let palindromeInput = document.getElementById("palindrome-input");
// let palindromeValue = palindromeInput.value;
// let palindromeOutput = document.getElementById("palindrome-output");
// if(uppercaser.textContent){//if the input is the same as a reversed version,

// }
// } -->


<h2>4. Even Checker</h2>

<li>The user should be able to enter a number into an input with id='even-checker-input'</li>
<li>They should then be able to click a "submit" button with id='even-checker-button' that will display a string in the form "It is ${true/false} that ${entered number} is even" with id='even-checker-output'</li>
<li>They should then be able to click a "submit" button with id='even-checker-button' that will display a string in the form "It is ${true/false} that ${entered number} is even" with id='even-checker-output'</li><br>

<input id="even-checker-input" type="number" placeholder="Enter a number">
<p id="even-checker-output">Waiting for input...</p>
<button onclick="evenChecker()" id="even-checker-button" type="submit">Submit</button>

<script>
// const evenChecker = () =>{
// let userInput = document.getElementById("even-checker-input");
// let userInputValue = userInput.value;
// let evenCheckerOutput = getElementById("even-checker-output").value;
// let trueOrFalse = (userInputValue % 2) === 0;
// evenCheckerOutput.value = `It is ${trueOrFalse} that ${userInputValue} is even`;
// }

// const evenChecker = () =>{
// let userInput = document.getElementById("even-checker-input");
// let userInputValue = userInput.value;

// if((userInputValue % 2)===0){
// return true
// }else{
// return false
// }
// // let trueOrFalse = (userInputValue % 2) === 0;
// let evenCheckerOutput = getElementById("even-checker-output").value;
// evenCheckerOutput.value = `It is ${trueOrFalse} that ${userInputValue} is even`;
// }

// const evenChecker = () =>{
// let userInput = document.getElementById("even-checker-input");
// let userInputValue = userInput.value;
// let trueOrFalse = (userInputValue % 2) === 0;

// window.alert(`It is ${trueOrFalse} that ${userInputValue} is even`);
// }

const evenChecker = () =>{
let userInput = document.getElementById("even-checker-input");
let userInputValue = userInput.value;
let trueOrFalse = (userInputValue % 2) === 0;
let evenCheckerOutput = document.getElementById("even-checker-output");
evenCheckerOutput.textContent = `It is ${trueOrFalse} that ${userInputValue} is even`;

}

</script>

<h2>5. Number Doubler</h2>

<li>The user should be able to enter a number into an input with id='doubler-input'</li>
<li>They should then be able to click a "submit" button with id='doubler-button' that will display a string in the form "${entered number} doubled is ${doubledVal}" with id='doubler-output'</li>
<li>They should then be able to click a "submit" button with id='doubler-button' that will display a string in the form "${entered number} doubled is ${doubledVal}" with id='doubler-output'</li><br>

<input id="doubler-input" type="number" placeholder="Enter a number">
<p id="doubler-output">Waiting for input...</p>
<button onclick="doubleNum()" id="doubler-button" type="submit">Submit</button>

<script>
const doubleNum = () =>{
let doublerInput = document.getElementById("doubler-input").value
let doublerOutput = document.getElementById("doubler-output")
let doubledValue = (doublerInput * 2)
doublerOutput.textContent = `${doublerInput} doubled is ${doubledValue}`
}

</script>

<h2>6. Average of Three Numbers</h2>

<li>The user should be able to enter 3 numbers into text inputs with ids 'average-input-1', 'average-input-2', and 'average-input-3'</li>
<li>They should then be able to click a "submit" button with id='average-button' that will display a string in the form "The average of ${numberOne}, ${numberTwo}, and ${numberThree} is ${average}" with id='average-output'</li>
<li>They should then be able to click a "submit" button with id='average-button' that will display a string in the form "The average of ${numberOne}, ${numberTwo}, and ${numberThree} is ${average}" with id='average-output'</li><br>

<input id="average-input-1" type="number" placeholder="Enter first number">&emsp;
<input id="average-input-2" type="number" placeholder="Enter another number">&emsp;
<input id="average-input-3" type="number" placeholder="Enter another number"><br>
<p id="average-output">Waiting for input...</p>

<button onclick="getAverage()" id="average-button" type="submit">Submit</button>

<script>
const getAverage = () =>{
let num1 = document.getElementById("average-input-1").value
let num2 = document.getElementById("average-input-2").value
let num3 = document.getElementById("average-input-3").value

let addedNums = num1 + num2 + num3
let avgOfNums = addedNums/3
let avgOutput = document.getElementById("average-output")
avgOutput.textContent = `The average of ${num1}, ${num2}, and ${num3} is ${avgOfNums}`

}



</script>

<h2>Bonus: Vowel Remover</h2>

Expand All @@ -50,4 +198,4 @@ <h2>Bonus: Vowel Remover</h2>
<li>They should then be able to click a "submit" button with id='vowel-remover-button' that will display the original string with all vowels removed with id='vowel-remover-output'. If the checkbox is checked, count y as a vowel. Otherwise, count y as a consonant.</li>

</body>
</html>
</html>
Loading