Sorry to break this up!
In regard to your diode question, I am not in any way a professional, but their function is based upon a PN junction. Something about the electron flow? Anyway, try googling (a key part of most of my answer!) PN junctions to find out a bit more, and you will see they have other implementations. AfroTechMods on YouTube did a great, in-depth diode video if you want to learn more.
On the topic of programming languages, you will find that JavaScript is an interpreted language, which is slower than a compiled language (as mentioned before). I have nothing against JavaScript and have used it extensively in web development, and fair play for wanting to use something you are comfortable with. However, you have to think about layers of abstractions (maybe look at the MIT Open courses online for more info), which are basically layers. As you add abstractions, the functionality is a higher level, and the task for you becomes simpler. You have to realise that you are further from the hardware when using JavaScript, which means it will run slower and have less control. It is unfair for people to say you have to learn C though, since even C is not quite as fast or low level as Assembly. All I am saying is that for certain tasks, you will find it easier to directly influence the hardware with C; also, you are severely limited to your choices of MCU, which is why professionals will use C or Assembly. You are also limited by what other people have done i.e. someone has to have written the module of code that takes your JavaScript and 'turns it into' machine code.
A final thing, PWM is a combination of what Hero999 wrote. It is just a way of analogue like control using digital signals, without having to use a DAC. A PWM signal is made up of these parts, and you will be able to identify them on an oscilloscope. You can get specific ICs for the job, as Hero999 said, but there is no point in using another MCU if it has the same capabilities as yours. Look in the datasheet of your MCU and take a peek at the PWM section. It'll probably be complicated but give it a go.
Ben
P.S. I apologise if some of this is not completely correct, I'm 14 and by no means a professional!