Guys help pliz understand this code. I don’t quite understand why creating the variable text = textNode.data and at the end writing this line of code again, only in a different order textNode.data = text. And why do you need to use the .data method?
function animate_string(id) { var element = document.getElementById(id); var textNode = element.childNodes[0]; // если представить что нет никаких потомков var text = textNode.data; setInterval(function () { text = text[text.length - 1] + text.substring(0, text.length - 1); textNode.data = text; }, 100); }
setIntervaland modifyingtext? - Alex KrassNodenodataproperties and no descendants. Conclusion: Someone wrote a noob style. By meaning, it seems to be trying to flip a string, for some reason using a property and a delay. - user207618