Skip to content

Instantly share code, notes, and snippets.

@milikkan
Last active February 25, 2021 21:43
Show Gist options
  • Save milikkan/19ac4713b9f01dc84eb3cb6344829d35 to your computer and use it in GitHub Desktop.
Save milikkan/19ac4713b9f01dc84eb3cb6344829d35 to your computer and use it in GitHub Desktop.
Array.fill() deneme
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Document</title>
</head>
<body>
<p>Diziyi fill etmek için değer gir:</p>
<input type="text" id="userValue" />
<script src="script.js"></script>
</body>
</html>
const input = document.getElementById("userValue");
const div = document.getElementById("arrayContent");
const myArray = [0, 0, 0, 0, 0, 0];
input.addEventListener("keyup", (e) => {
myArray.fill(e.target.value);
div.innerHTML = `<pre>${myArray}</pre>`;
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment