-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBasics2.js
47 lines (32 loc) · 1.1 KB
/
Basics2.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
//Reverse
function reverseInput() {
let input = document.getElementById('input1').value;
let reversed = input.split('').reverse().join('');
document.getElementById('output1').innerHTML = reversed;
};
//Caps-Lock
function allCaps() {
let input = document.getElementById('input2').value;
let caps = input.toUpperCase();
document.getElementById('output2').innerHTML = caps;
};
//Lower-case
function lowerCase() {
let input = document.getElementById('input3').value;
let nocaps = input.toLowerCase();
document.getElementById('output3').innerHTML = nocaps;
};
//Superscript
function Subscript() {
let input = document.getElementById('input15').value;
let output = document.getElementById('output15');
output.innerHTML = '<sub>' + input + '</sub>';
};
//toggel-case
function toggleCase() {
let input = document.getElementById("input16").value;
let output = input.split('').map(function(char) {
return char === char.toUpperCase() ? char.toLowerCase() : char.toUpperCase();
}).join('');
document.getElementById("output16").innerHTML = output;
}