qstack + localhost
This commit is contained in:
parent
433fcc4754
commit
2ac625d825
15
fetch.js
15
fetch.js
|
@ -5,3 +5,18 @@ fetch(url)
|
||||||
.then(data => {
|
.then(data => {
|
||||||
console.log(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');
|
||||||
|
}
|
Loading…
Reference in New Issue