I was wondering if you could comment this code for me so i know exactly what's happening on every line.
<div class="dropdown">
<button onclick="myFunction()" class="dropbtn">Dropdown</button>
<div id="myDropdown" class="dropdown-content">
<a href="#home">Home</a>
<a href="#about">About</a>
<a href="#contact">Contact</a>
</div>
</div>
<script>
/* When the user clicks on the button,
toggle between hiding and showing the dropdown content */
function myFunction() {
document.getElementById("myDropdown").classList.toggle("show");
}
// Close the dropdown if the user clicks outside of it
window.onclick = function(event) {
if (!event.target.matches('.dropbtn')) {
var dropdowns = document.getElementsByClassName("dropdown-content");
var i;
for (i = 0; i < dropdowns.length; i++) {
var openDropdown = dropdowns[i];
if (openDropdown.classList.contains('show')) {
openDropdown.classList.remove('show');
}
}
}
}
</script>
>>62266063
It's already commented retard
>>62266589
They commented what the chunk of code does, i wanted someone to comment what each individual line is doing, to help me understand how the code works
>>62266698
So go ask them fucking newfag
>>62266747
He can't. OP probably got the job saying he knows JavaScript, now he's got something to do with JS and can't.
>>62266915
>>62266915
>>62266063
>mfw 4chan doesn't allow you to run script tags
>mfw I have no facehttps://pastebin.com/QtJNhAis
Anyway here it is:
>>62266939
Thanks anon, if you dont mind; what are some good websites/books to learn web development from and approx how long does it take to learn html,css and js to a competent level?
>>62266831
Actually just learning html and css in my free time via script kitty various sources. Doing it i have got a pretty clear idea of how html works, able to do my own basic websites. I guess because its very clear e.g color: green. but with java i simply cant read and understand. Guess im going to need to take a course or something
>>62267053
>script kitty
>>62266698
I have never even written a line of Javascript but knowing Java and C++ each line seems pretty fucking obvious. Do you know any programming language at all?
>>62267194
I mean. Id just look at say 15 websites source codes, read through them and then go about creating something of my own through using elements of them. Now i undetstand basic html/css concepts due to doing that. I can create my own webite in html/css without looking at others code.
With js i can't, when i read it i cant understand it, its a more complex language. I plan to learn it, via books and online courses i was just asking the other anon for recommendations
>>62267258
Nope. I plan to learn web languages as my first set. Then move onto vb. After i have learnt those few, c# and java.
>>62267365
>first i will learn a, then b and then c because i think c is very hard
This is the worst [g/hackforums/generic tech board] meme ever. Just fucking learn what you want to learn.
>>62267365
That explains a lot. Just do a few programming courses, be it online or at university. Don't expect that you'd know anything 3 months from now even doing those. It's like going to the gym, results take time.
>>62267365
i hate how everyone thinks the essence of learning to program is learning a language
>>62268486
What is the essence?
>>62268817
Math and logic
>>62267365
This has nothing to do with knowing anything "well".
Assuming you're not a troll, there is a web dev general, just look at the first fucking links in there, and quit expecting people to spoonfeed you.
If you think you have any fucking clue about the thing your asking about, there is a stupid questions general.
I've managed to keep expletives out of here, but hey, OP, fuck you, you fucking mental flatliner.
I learned how to program in an IDE. Never used a text editor and compiler before. I got vim now which compiler do I use for c++? How do I compile? How do I debug?
A thread died for this trash.