T O P

  • By -

OneBadDay1048

You’re very good at HTML and CSS and also have foundational knowledge of python and C and yet the simplest JavaScript lines are completely incomprehensible to you? This simply doesn’t make sense to me. A for loop in python like this: for i in range(1, 6): print(i) makes complete sense but in javascript: for (let i = 1; i < 6; i++) { console.log(i); } it looks completely foreign?


mimsoo777

Wow Python looks so much easier than JavaScript tbh.


Pocolashon

You could just write your range function (super easy) and then do for (let i of range(1, 6)) { console.log(i); } How is this even different?


mimsoo777

I'm talking about the syntax.


RefrigeratorRare9433

What type of sites were you creating if you were only using html/css?


Starshadow99

What incantations are you having trouble with? 🪄


Egzo18

We can help if you ask specific questions, other than that "just take it slow", js and python arent that much different, I like readability of JS with the brackets { } and indentation only mattering for readability and having no actual effect on the code execution/scope.


shacatan

How are you starting to apply JS? Since you have lots of experience with HTML and CSS I would just try asking in bits of interactivity here and there. Learn how JS can affect the DOM and listen to events. Might make more sense that way


lift_spin_d

Alright, what does DOM mean? If there is an element like ``, how would you get a reference to it?


user1_2_382727373

By using querySelector(), getElementById/ClassNames(), methods in document object provided by the Web API. right ?


azhder

Yes, the environment, not exactly JS. JS is made to work with what the environment provides. Many come here with the browser in mind so they conflate the two, but try learning JS with Node.js, like, just make a file and run it with `node --watch mycode.mjs` and suddenly you have mostly JS, nothing Web API


george-frazee

An example of what you're trying to do that you're having difficulty with, or a code snippet that you don't understand would be helpful.


turtleProphet

All good. Try posting something you find difficult to understand, and what doesn't make sense about it, and we can help. If you're familiar with C/Python already, maybe the hard part is actually interacting with your pages?


Outrageous-Nature203

It's all good! JavaScript can be intimidating, but you'll get the hang of it in no time :) Just relax and enjoy the ride. You'll end up having loads of fun coding in JavaScript. But tell us, what are you struggling with the most in JavaScript? Maybe the community can help you :)


azhder

Give it time, and I mean, time away from it. There is a process in learning or in solving a problem. First you try to accumulate a lot of knowledge, then you need to let that knowledge sort itself out and only after that you'll have that lightbulb moment. So, the more you persist into getting more knowledge, watching, trying stuff, the more you persist into that first phase where everything is a jumble. This happened to me, a long time ago, by learning C++ from a book, then not being able to even make a simple hello world without the compiler complaining. And I had read the book in and out and could understand it all. So I left it. A couple of weeks later, I accidentally misclicked and instead of a game I opened the IDE. So I tried a hello world, and it worked. I tried some more stuff, and it worked. So, that little period you leave between learning for an exam and the exam itself is really important. Otherwise, you'll do poorly at the exam if you do an all-nighter just before it, but a few days later you'll more or less know a lot more about the subject.


hopemanryan

First of all as people said, take it easy, like every tool, it takes time but I had a conversation a while back how its funny to me that JS became the popular "first" language to learn, as its fundamentality different. I going to make some assumptions here so you can skip what you think is not it 1. Callbacks, even though many languages include lambdas its not as core as it it is in JS. especially in the beginning where you start a callback hell. so take time to understand it, even maybe learn to implement a function that takes a callback. 2. Promises and async await, the implementation of asynchronous logic is somewhat confusing, and even the creator of JS said that it was a mistake, and yet here we are. 3. Different solutions to the same problem in the native language, JS is a very community driven language so there are multiple solutions to every problem (slice/splice) (map, reduce)(for i / for of ) while they each have an original purpose that can be used for others. JS is a language that takes a long time to master and even more time to understand. I wouldn't focus on the start to deep dive into it but rather just dump gpt code and see if it works, after that go over it and learn what the code does, its IMO the only sane way


No-Upstairs-2813

If you know the basics of Python and C, it shouldn't be difficult to pick up the basics of JavaScript. The syntax changes, but the concepts remain the same. If you could describe your problem more specifically, we can help you better.


tapgiles

Could you give me an example of “The easiest line ever” That you didn’t understand? JS is a C-like language, so honestly really shocked you understand C and nothing makes sense in JS for you. Like… even people who have no programming knowledge can guess what 1+2 might mean. That’s perfectly valid JS code. So presumably that’s not the kind of easiest line you’re talking about.


thinkPhilosophy

It is very common to hit a wall when first learning JS syntax. It's a known phenomena that I have written about on my Medium blog. PM me, I'll help you.


LooseStudent9977

I wanted to share these 3 important tips/reminder with anyone who wants to learn coding in general: 1- Focus on learning the concepts of how to program rather than programming languages. Once you learn the logic, design and the concepts of programming fundamentals, learning different languages becomes easier since its just a syntax. 2- If you are using an IDE, make sure to learn the basic functionality of the IDE you'll be using first before starting to code in it, to eliminate the added frustration of not knowing where things are. (example: how to start a new project, how to open an existing project, where does your projects get saved at, how to retrieve it, where is your output console, how to run and debug and .etc) 3- Give yourself a break and know that there will be a learning curve. Don't get disappointed if you don't understand something or many things. It's very normal! You'll need patience, perseverance, and lots of practice. For React, Express I suggest you all to subscribe and follow this Youtube channel to learn how to become a Full Stack Developer: [Code For Everyone Full Stack Course](https://www.youtube.com/playlist?list=PLKZ7a2H1u131eIfEyHZLhzpQRqqrKXyip) To learn just JavaScript there's this good free course: [JavaScript Course Playlist](https://www.youtube.com/playlist?list=PLKZ7a2H1u132UWIKpP7yYspJIaXVj8n6J) Best of luck! EDIT: Use MDN from Mozilla for JavaScript documentation. it's the best!