I’m not a programmer myself, but I have made quite a few static web pages over the years for my own use. I code the HTML and CSS by hand, and I think I have a basic understanding of how they work. But JavaScript has always been a mystery to me.
So the other day I asked GPT-4 to teach me the basics of JavaScript. It responded with an understandable outline of the language and a few code samples. Nothing special there. But then I tried asking it questions, and that is where it really shone.
When, for example, I asked “In expressions like console.log("x is greater") or window.onload = function(), what is the role of the period (.) between console and log and between window and onload?,” it replied “The period (.) in JavaScript is used to access properties or methods of an object” and continued with a multiparagraph explanation, including examples. I then followed up with “How many properties or methods does the 'window' object have?,” and it gave me a list of common properties and methods. I continued asking questions and asking for feedback on some code I wrote until I hit my prompt limit. I felt like I was learning very quickly.
The next day, I tried a similar thing with Python, which I also knew nothing about, and once again the lesson went very smoothly.
I have no idea how good it would be for more advanced learners, but for a beginner like me GPT-4 seems like a great programming teacher. Being able to ask questions and get full answers and feedback immediately was particularly exciting.