mirror of
https://github.com/hexahigh/games.git
synced 2025-12-11 20:15:38 +01:00
a
This commit is contained in:
parent
af7542f851
commit
b95c122693
@ -1,11 +1,17 @@
|
|||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html>
|
<html>
|
||||||
<head>
|
|
||||||
|
<head>
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||||
</head>
|
</head>
|
||||||
<script src="index.js" defer></script>
|
<script src="index.js" defer></script>
|
||||||
<body>
|
|
||||||
|
<body>
|
||||||
<textarea id="textInput"></textarea>
|
<textarea id="textInput"></textarea>
|
||||||
<button id="processButton">Process</button>
|
<button id="processButton">Process</button>
|
||||||
</body>
|
<h3>Output</h3>
|
||||||
|
<textarea id="myTextarea"></textarea>
|
||||||
|
<button onclick="addArrayToTextarea()">Add Array to Textarea</button>
|
||||||
|
</body>
|
||||||
|
|
||||||
</html>
|
</html>
|
||||||
@ -1,11 +1,19 @@
|
|||||||
const textInput = document.getElementById("textInput");
|
const textInput = document.getElementById("textInput");
|
||||||
const processButton = document.getElementById("processButton");
|
const processButton = document.getElementById("processButton");
|
||||||
|
|
||||||
|
var inputText = "NaN"
|
||||||
|
var lines = "NaN"
|
||||||
|
var modifiedArr = "NaN"
|
||||||
|
|
||||||
processButton.addEventListener("click", function () {
|
processButton.addEventListener("click", function () {
|
||||||
const inputText = textInput.value;
|
inputText = textInput.value;
|
||||||
const lines = inputText.split(/[\n\r]+/);
|
lines = inputText.split(/[\n\r]+/);
|
||||||
console.log(lines);
|
console.log(lines);
|
||||||
const arr = ['first', 'second', 'third'];
|
modifiedArr = linus.map(i => '"' + i + '",');
|
||||||
const modifiedArr = arr.map(i => '"' + i + '",');
|
|
||||||
console.log(modifiedArr)
|
console.log(modifiedArr)
|
||||||
});
|
});
|
||||||
|
|
||||||
|
function addArrayToTextarea() {
|
||||||
|
const textarea = document.getElementById("myTextarea");
|
||||||
|
textarea.value = modifiedArr
|
||||||
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user