second commit
This commit is contained in:
parent
d2145779c4
commit
e36e092d1d
18
fetch.js
18
fetch.js
|
@ -1,7 +1,21 @@
|
|||
const url = "http://localhost/15.05/get.php"
|
||||
const url = "http://localhost/P20.05/get.php"
|
||||
|
||||
fetch( url + 'get.php')
|
||||
fetch(url)
|
||||
.then(response => response.json())
|
||||
.then( data => {
|
||||
console.log(data)
|
||||
})
|
||||
|
||||
function sortujSufiksy() {
|
||||
const slowo = document.getElementById('slowo').value;
|
||||
const sufiksy = [];
|
||||
for (let i = 0; i < slowo.length; i++) {
|
||||
sufiksy.push(slowo.slice(i));
|
||||
}
|
||||
document.getElementById('nieposortowane').textContent = formatSufiksy(sufiksy);
|
||||
sufiksy.sort();
|
||||
document.getElementById('posortowane').textContent = formatSufiksy(sufiksy);
|
||||
}
|
||||
function formatSufiksy(sufiksy) {
|
||||
return sufiksy.map((sufiks, index) => `${index + 1} ${sufiks}`).join('\n');
|
||||
}
|
|
@ -15,7 +15,7 @@
|
|||
<pre id="nieposortowane"></pre>
|
||||
<h2>Posortowane Sufiksy</h2>
|
||||
<pre id="posortowane"></pre>
|
||||
<script src="js.js"></script>
|
||||
<script src="fetch.js"></script>
|
||||
|
||||
</body>
|
||||
|
||||
|
|
Loading…
Reference in New Issue