Can somebody help me understand this code? | Sololearn: Learn to code for FREE!
Новый курс! Каждый программист должен знать генеративный ИИ!
Попробуйте бесплатный урок
+ 1

Can somebody help me understand this code?

https://code.sololearn.com/Wud0Xx170Mq8/?ref=app I want to understand it. I know basic js, but I think understanding this code will help me understand js better. None of it was explained in w3schools.

31st Jul 2018, 12:57 AM
Daniel Cooper
Daniel Cooper - avatar
7 ответов
+ 7
@Daniel Cooper , its a very nice code of syntax highlighting, seeing it I now realize that I used it a lot when practicing on w3schools, nice. btw even if we write a detailed description of it it ll be use useless, my advice is go though the main w3CodeColor() function and ask which part you are stuck. in the heart of it is the extract constructor function, whose job is to extract strings as an object and apply styles then in the end merge them together. I would suggest to study first only the htmlMode function, then you can easily figure out cssMode and jsMode. heres a stripped version of it with 100 lines https://code.sololearn.com/WGL5fptnleVz/?ref=app
31st Jul 2018, 5:57 AM
Morpheus
Morpheus - avatar
+ 6
That's 326 lines of code you want us to explain?! Are you alright?
31st Jul 2018, 2:13 AM
Akib
Akib - avatar
+ 3
https://code.sololearn.com/WA88031Si45m/?ref=app This code has 9 lines of js codes, I can explain. 😁
31st Jul 2018, 6:19 AM
Calviղ
Calviղ - avatar
+ 2
Jay Matthews Lol. I found this on w3schools. If you can find a better way to do this, than please tell me xD
31st Jul 2018, 4:35 AM
Daniel Cooper
Daniel Cooper - avatar
+ 2
I thought about it Calviղ But since this code was written, I just assumed it was the simplest way. I'm new to coding so I assumed. Remind me not to do that xD I mean, why post such a complex code when it could easily be simplified? Lol Lol. Regardless, I'll try using regexp.
31st Jul 2018, 5:15 AM
Daniel Cooper
Daniel Cooper - avatar
+ 1
I didn't really expect anyone to do it. This was just posted in case someone had some time xD And no I'm not alright My brain has been damaged by the Oklahoma heat :(
31st Jul 2018, 3:42 AM
Daniel Cooper
Daniel Cooper - avatar
+ 1
Use regex could simplify it.
31st Jul 2018, 5:11 AM
Calviղ
Calviղ - avatar