
acidd
Jako neofita w #programowanie to chciałbym napisać tylko tyle, że debugger to zajebista sprawa, zwłaszcza wchodzenie w klasy samej javy :)
dixieman
możesz nie spamować tym g....em ?
- konto usunięte

sz bez problemu robić d
let strzalki = [];
strzalki.push(new strzalka());
let svg = document.createElementNS("[http://www.w3.org/2000/svg",](http://www.w3.org/2000/svg",) "svg");
svg.setAttribute('id', 'svg2');
svg.setAttribute('width', '500');
svg.setAttribute('height', '500');
svg.setAttribute("viewBox", "0 0 500 500");
document.getElementById('pole').appendChild(svg);
svg = document.getElementById('svg2');
strzalki.forEach(x => x.rysuj(svg));
function strzalka(svg) {
this.rysuj = function (svg) {
let a = document.createElementNS('[http://www.w3.org/2000/svg',](http://www.w3.org/2000/svg',) 'a'); //ROZWIĄZANIE
svg.appendChild(a); //ROZWIĄZANIE
let newText = document.createElementNS('[http://www.w3.org/2000/svg',](http://www.w3.org/2000/svg',) 'text');
newText.setAttribute('x', 50);
newText.setAttribute('y', 50);
newText.setAttribute('fill', 'red');
newText.textContentthis (fragment .bind(this)), a w tym miejscu thisem nie jest ob (ten obiekt jest dopiero w trakcie tworzenia), a jest nim obiekt globalny (czyli window w przypadku przeglądarki). Kiedy tworzysz zmienną globalną (a tworzysz ją, ponieważ w 1. linijcie piszesz po prostu name = "Karol ";, bez const czy let) to tak naprawdę tworzysz też property na obiekcie