Compare commits
No commits in common. "6d1829027b2a43329858a3ed06f88a55fb64f539" and "cf17e628b32b8b5867ad7bf46dea2a3c9729f57f" have entirely different histories.
6d1829027b
...
cf17e628b3
4 changed files with 1 additions and 101 deletions
|
@ -29,7 +29,7 @@
|
|||
"space-infix-ops": "warn",
|
||||
"brace-style": "warn",
|
||||
"comma-spacing": "warn",
|
||||
"indent": ["warn", { "SwitchCase": 2 }],
|
||||
"indent": "warn",
|
||||
"arrow-spacing": "warn"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +0,0 @@
|
|||
.form-control {
|
||||
width: 50% !important;
|
||||
text-align: center;
|
||||
}
|
|
@ -1,91 +0,0 @@
|
|||
window.addEventListener("load", () => main());
|
||||
|
||||
const input_name = "firstname";
|
||||
|
||||
const main = () => {
|
||||
// Reset content of the input
|
||||
document.getElementById(input_name).value = "";
|
||||
|
||||
// Call callback when editing the input
|
||||
document.getElementById(input_name).addEventListener("input", update_const);
|
||||
};
|
||||
|
||||
// Callback: called when firstname is changed
|
||||
const update_const = () => {
|
||||
const firstname = document.getElementById(input_name).value;
|
||||
const firstname_const = get_const(firstname.split(''));
|
||||
|
||||
console.log(`output: ${firstname_const}`);
|
||||
};
|
||||
|
||||
const get_const = (letters = Array) => {
|
||||
console.log(`input: ${letters}`);
|
||||
|
||||
// Store constants of each letters of the firstname
|
||||
let const_data = [];
|
||||
|
||||
// Store some constants info
|
||||
//let const_infos = {};
|
||||
|
||||
// Assign each letter to a const, fallback to 1 if no one has been found
|
||||
switch (letters) {
|
||||
/* case 'a':
|
||||
const_data.push(); */
|
||||
/* case 'b':
|
||||
const_data.push(); */
|
||||
/* case 'c':
|
||||
const_data.push(); */
|
||||
/* case 'd':
|
||||
const_data.push(); */
|
||||
/* case 'e':
|
||||
const_data.push(); */
|
||||
/* case 'f':
|
||||
const_data.push(); */
|
||||
/* case 'g':
|
||||
const_data.push(); */
|
||||
/* case 'h':
|
||||
const_data.push(); */
|
||||
/* case 'i':
|
||||
const_data.push(); */
|
||||
/* case 'j':
|
||||
const_data.push(); */
|
||||
/* case 'k':
|
||||
const_data.push(); */
|
||||
/* case 'l':
|
||||
const_data.push(); */
|
||||
/* case 'm':
|
||||
const_data.push(); */
|
||||
/* case 'n':
|
||||
const_data.push(); */
|
||||
/* case 'o':
|
||||
const_data.push(); */
|
||||
/* case 'p':
|
||||
const_data.push(); */
|
||||
/* case 'q':
|
||||
const_data.push(); */
|
||||
/* case 'r':
|
||||
const_data.push(); */
|
||||
/* case 's':
|
||||
const_data.push(); */
|
||||
/* case 't':
|
||||
const_data.push(); */
|
||||
/* case 'u':
|
||||
const_data.push(); */
|
||||
/* case 'v':
|
||||
const_data.push(); */
|
||||
/* case 'w':
|
||||
const_data.push(); */
|
||||
/* case 'x':
|
||||
const_data.push(); */
|
||||
/* case 'y':
|
||||
const_data.push(); */
|
||||
/* case 'z':
|
||||
const_data.push(); */
|
||||
|
||||
default:
|
||||
const_data.push(1);
|
||||
}
|
||||
|
||||
// Multiply all the constants together
|
||||
return const_data.reduce((a, b) => a * b);
|
||||
};
|
|
@ -26,14 +26,9 @@
|
|||
</head>
|
||||
<body>
|
||||
<img src="images/logo.webp" class="img-fluid mx-auto d-block" alt="Banner">
|
||||
|
||||
<input id="firstname" class="form-control form-control-lg mx-auto d-block" type="text" placeholder="Maria">
|
||||
|
||||
<hr>
|
||||
<figure class="text-center">
|
||||
<%- readme %>
|
||||
</figure>
|
||||
|
||||
<script src="js/main.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
Loading…
Reference in a new issue