Frontend/fatcsabi.js

52 lines
885 B
JavaScript
Raw Permalink Normal View History

2024-12-14 13:50:02 +00:00
let url = "https://jsonplaceholder.typicode.com/posts";
async function asd(url) {
try{
let result = await fetch(url);
let jsadatszerkezet = await result.json();
console.log(jsadatszerkezet);
} catch {
console.log("ERROR");
} finally {
console.log("END");
}
}
//asd(url);
async function name(url) {
fetch(url, {
method: 'PUT',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({
name: "Szabó Márton",
email: "digivagyok@gmail.com"
}),
})
}
class Szemely{
#nev;
constructor(nev){
this.#nev = nev;
}
get nev(){
return this.#nev;
}
set nev(ujnev){
this.#nev = ujnev;
}
}
let digi = new Szemely("Digi");
digi.nev = "Szabó Márton";
console.log(digi.nev);