a1/js.js

22 lines
663 B
JavaScript
Raw Normal View History

2024-05-17 08:26:17 +00:00
const url = "http://localhost/pk/"
2024-05-17 08:12:11 +00:00
fetch( url + 'get.php')
.then(response => response.json())
.then( data => {
console.log(data)
})
2024-05-17 08:26:17 +00:00
2024-05-20 05:21:55 +00:00
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);
}git
function formatSufiksy(sufiksy) {
return sufiksy.map((sufiks, index) => `${index + 1} ${sufiks}`).join('\n');
}