<body>
<h1>Add Alphabet</h1>
<label for="word">Type your word :</label>
<input type="text" id="word" class="js--word" />
<br />
<input type="button" value="submit your word" class="js--btn" />
<p class="js--result"></p>
<script src="index.js"></script>
</body>
const input = document.querySelector(".js--word");
const button = document.querySelector(".js--btn");
const result = document.querySelector(".js--result");
function handleSubmit() {
const wordTyped = input.value;
const firstLetter = wordTyped.charAt(0);
const resultText = `${firstLetter}${wordTyped}${firstLetter}`;
result.innerText = `Funny result is ➡️️➡️️ ${resultText} `;
}
button.addEventListener("click", handleSubmit);
꽤 쉬웠다. 아무래도 혼자 하다보니 나도 모르게 쉬운것만 찾아 하려는 듯한 느낌이..