From b95c122693e5816d723942b3113a90e9fe5c04bc Mon Sep 17 00:00:00 2001 From: Boof <97455552+hexahigh@users.noreply.github.com> Date: Fri, 28 Apr 2023 10:24:18 +0200 Subject: [PATCH] a --- other/urls to array/index.html | 22 ++++++++++++++-------- other/urls to array/index.js | 16 ++++++++++++---- 2 files changed, 26 insertions(+), 12 deletions(-) diff --git a/other/urls to array/index.html b/other/urls to array/index.html index 93b44a3..ba55e6d 100644 --- a/other/urls to array/index.html +++ b/other/urls to array/index.html @@ -1,11 +1,17 @@ - - - - - - - - + + + + + + + + + +

Output

+ + + + \ No newline at end of file diff --git a/other/urls to array/index.js b/other/urls to array/index.js index 029c69f..b677d64 100644 --- a/other/urls to array/index.js +++ b/other/urls to array/index.js @@ -1,11 +1,19 @@ const textInput = document.getElementById("textInput"); const processButton = document.getElementById("processButton"); +var inputText = "NaN" +var lines = "NaN" +var modifiedArr = "NaN" + processButton.addEventListener("click", function () { - const inputText = textInput.value; - const lines = inputText.split(/[\n\r]+/); + inputText = textInput.value; + lines = inputText.split(/[\n\r]+/); console.log(lines); - const arr = ['first', 'second', 'third']; - const modifiedArr = arr.map(i => '"' + i + '",'); + modifiedArr = linus.map(i => '"' + i + '",'); console.log(modifiedArr) }); + +function addArrayToTextarea() { + const textarea = document.getElementById("myTextarea"); + textarea.value = modifiedArr + }