Skip to content

Instantly share code, notes, and snippets.

@lenka21
Created May 7, 2015 07:07
Show Gist options
  • Save lenka21/5e8c518b8f52a0d69d77 to your computer and use it in GitHub Desktop.
Save lenka21/5e8c518b8f52a0d69d77 to your computer and use it in GitHub Desktop.
Reverse ciągu znaków
<!DOCTYPE html>
<html>
<head lang="pl">
<meta charset="UTF-8">
<title>zadanie</title>
<script src="main.js"></script>
</head>
<body>
<h1>Wpisz znaki</h1>
<input id="list">
<button onclick="myFunction()">Reverse</button>
<p id="result"></p>
</body>
</html>
function myFunction() {
var list = document.getElementById("list").value;
var duration = list.split("");
var my_reverse = duration.reverse();
var string = my_reverse.join("");
document.getElementById("result").innerHTML = string;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment