#JavaScript #Programming #LearningJS #WebDevelopment
Hey there! 😊 I completely understand where you’re coming from – learning JavaScript can definitely be a challenging experience, especially when you’re just starting out. But don’t worry, you’re not alone in feeling this way! Many beginners find themselves hitting a wall when they reach topics like arrays and loops, so you’re not the only one struggling.
Let’s break down why JavaScript can seem so hard and how you can overcome these challenges:
### 1. JavaScript is a Different Beast
While C# and JavaScript may have some similarities, they are also fundamentally different languages with their own unique quirks and features. JavaScript is a dynamically typed language, meaning you don’t have to declare the data type of a variable when you declare it. This can lead to some unexpected behavior if you’re used to working with statically typed languages like C#.
### 2. Asynchronous Nature of JavaScript
JavaScript is a single-threaded language that utilizes asynchronous programming. This means that certain operations can be executed in parallel without blocking the main thread. Understanding how asynchronous functions work and how to handle callbacks, promises, and async/await can be tricky at first but is essential for building modern web applications.
### 3. Concepts like Arrays and Loops
Arrays and loops are fundamental concepts in programming, but they can be challenging to grasp initially. Understanding how to manipulate arrays, iterate through them using loops, and apply concepts like map, filter, and reduce can take some time to fully understand.
### Tips for Overcoming JavaScript Challenges:
1. **Practice, Practice, Practice:** The more you practice writing JavaScript code, the more comfortable you will become with its syntax and concepts. Consider working on small coding challenges or projects to reinforce your understanding.
2. **Utilize Online Resources:** There are a plethora of online resources available that can help you learn JavaScript more effectively. Websites like MDN Web Docs, Stack Overflow, and online coding platforms like Codecademy and freeCodeCamp offer tutorials, documentation, and forums where you can seek help and guidance.
3. **Join a Community:** Engaging with a community of fellow developers can provide you with support, motivation, and solutions to your coding problems. Consider joining online coding forums, attending local meetups, or participating in hackathons to connect with like-minded individuals.
4. **Take Breaks:** It’s important to give yourself a break when you’re feeling frustrated or overwhelmed. Sometimes stepping away from the computer and taking a walk can help you clear your mind and approach the problem with a fresh perspective.
5. **Don’t Give Up:** Learning any new skill takes time and persistence. It’s okay to struggle and encounter roadblocks along the way. Remember that every challenge is an opportunity for growth and learning. Stay determined, and you’ll eventually overcome the hurdles in your JavaScript journey.
In conclusion, learning JavaScript can be a daunting task, especially when you’re just starting out. But with patience, practice, and perseverance, you can overcome the challenges and become a proficient JavaScript developer. Keep pushing yourself, seek help when needed, and don’t be afraid to make mistakes – they are all part of the learning process!
Hang in there, and keep coding! 💻🚀
But Javascript is very easy, especially the basic things like Arrays and Loops which every language has. BTW What were you stuck in the 4th Project?
JS is a whole different thing to HTML and CSS. There is actual logic involved there so it is going to take a while to adjust to that. Just keep at it.
Because it’s a shit language made by shit people who hated their life. Go learn an object oriented backend language first and get to know the concepts in a normal language. Never learn js on its own. Or you gonna have headaches and hate programming all together. If you have to start on frontend, try typescript instead
Javascript takes some time to get the hang of even if you’ve done programming before because you’re not just learning javascript, you’re learning the standard web APIs as well, which are what allow you to access and modify data on your webpage.
On top of that, Javascript syntax can feel confusing if you haven’t studied both object oriented and functional languages before, because javascript is a bit of a hybrid between the two. You’ve got all the object oriented concepts from C#, (classes, objects, inheritance, etc.) but also a lot of functional programming concepts like anonymous functions and arrow functions.
Because HTML and CSS are not programming languages and javascript is.
Try React. JavaScript became easier for me when I started projects with react
Is it the language itself you are struggling, or is it the APIs? I think the language is pretty easy if you already know C# but using APIs to do stuff like dom manipulation (with documentation) etc. takes some getting used to. C# and .Net are opinionated stuff, they have pretty good centralized documentation and since most of the stuff is developed by Microsoft the whole development process feels really coherent. On the other hand, with web you need to know how javascript interfaces with html and css, how you can use web apis, how you can use the browser to make sense of all this and debug the app, how to bundle stuff, how node comes into play etc. The documentation is also scattered all around the place. There are just much more stuff to keep track of. I’m not even taking (meta)frameworks and typescript into account. They all introduce their own templating languages, their own server-client interactions and build systems. So I think it boils down to the fact that with web development you have to learn a lot of things initially to have a good mental modal of what you are doing whereas with C# the tooling takes care of a lot more for you, and the ecosystem has a more coherent feeling. Keep building stuff though, and you will get the hang of it in no time. I too felt like a complete idiot when i started doing these stuff
For the first time, you are now *programming*.
HTML and CSS only *describe*. HTML describes the content and semantics, CSS describes the *style* – none of them has flow, logic, state. None of them has anything to do with *programming*.
The above does absolutely not mean that HTML/CSS are easy – especially the intricacies of CSS are quite complicated, but they are entirely different to programming.
JavaScript as *programming language* is just as easy as the *languages* HTML and CSS. It’s also only vocabulary and grammar.
The tricky and difficult bit is *programming* (no matter the *programming language*). You have to learn to think in different patterns. You have to learn to think in *steps*, in *algorithms*.
Does it work if you change it to array.splice(2,1) the 1 says how many elements to remove
you’ve never learned programming then
not ment as a rude comment or anything, but if you’ve coded in C# before, you shouldn’t have problems with learning another language.
Because aslong as your language doesn’t have weird purposes or rules, they all more or less do the same things in more or less the same manner, especially when you consider “language irrelevant” concepts exist, that can be coded in most languages.
Arrays and loops are basic universal programming concepts
an array is just an indexed list in where you usually have a key corelate to a(n unique) entry in the list.
C# has List types, which imo are more complex than Arrays to understand for beginners.
a loop is just a replay function with conditions.
if I’ve miss understood something, my apologies, but it sounds like you’re not that deep into programming yet
definetly try to reflect on why something was hard or what key moments made you able to finish the assignment.
F.e. what did you learn while doing the assignments
(IT is an universe sized topic, so you can and will always learn, never think you’ve done everything there is todo and remember that just because someone else did it, doesn’t mean you shouldn’t. That practice is what you could be needing)
How did you use C# for “two years” but are only just now learning the programming parts of Javascript? Things like constants, variables, loops and arrarys aren’t unique features to Javascript, they are also extensively used in C#.
I have done some work in Unity, and while it uses C#, many of the C# scripts are done for you ahead of time, or can be gained from other projects. I can see how this sort of experience would not actually help you now that you’re actually learning the programming part of a programming language, as opposed to the coding part.
It seems to me that there’s a vast hole in your knowledge where the first five minutes of Comp Sci 101 should be, and that you don’t know the ‘why’ of what you’re doing, so you can’t figure out the ‘how.’ In your time with C# and with JavaScript, did you skip some early easy lessons because they appeared to be read-only information dumps on how a computer works, such as how things get interpreted and compiled and what various protocols and paradigms are? Similarly, I hope you didn’t jump straight to Javascript without a very strong understanding of ‘why’ you are manipulating the dom and how to do it.
It’s not really that hard if you started from Java or have experienced other programming languages. C is much harder than JavaScript. I’m not trying to say you are bad but JavaScript is really fun and easy to use. Maybe you just need some practice? Try leetcode puzzles and start studying algorithms everyday it will really have an effect on you I promise
I also thought JavaScript was hard before but after studying several courses and attending bootcamp I can now code with confidence
Not sure how to help without you to explain what makes it hard. Is it because Javascript is not a purely object oriented language, or is it because your code can still run even though it is faulty, or because you can’t completely understand about its relationship with the HTML document and its style, or something else…?
I’m assuming your C# experience wasn’t extensive, because you are correct that the two languages are similar.
It might sound weird, but update your expectations of what you can do in a few hours. HTML and CSS are fundamentals much much simpler than Javascript. When I was first learning Javascript, I gave myself a project to add a clock to my webpage. One that gets the current time, and updates every second. It took me 2 weeks. I can now do this in probably 2.minutes.
If you only give yourself 1 day and then give up, you’re going to have a hard time moving forward. Programming is hard, and it’s okay to get stuck. Fight through it. Keep banging away. Take breaks. Go for a walk. Talk to your friends or family about the problem. Talk to a rubber duck. Then come back and try again.
The struggle is how you learn Javascript. Eventually, slowly, without you noticing, you’ll get better at it, and be able to solve problems faster and faster.
An analogy I use is learning to play a musical instrument. You wouldn’t expect to learn how to play a song in just a few hours if you are just stating out. It takes consistent practice every day for monthes to get to that point. And there is not work around. You can’t just “look up” how to play a song. You need to understand how to do it with your own body and brain too.
Focus on the fundamentals. Really understand what every single line of code does. The thing about programming is nothing is there by accident. All the code has a specific purpose. You should know what that is for every line.
Sorry to tell you, but you sound like the typical “I did X tutorials” *”programmer”* who actually never understood *programming*.
Had you actually understood *programming*, i.e. looking at the *algorithm*, not at the *code* you wouldn’t struggle so much with a new language (no matter which).
You learnt and used C#, but you never failed to learn *to program*.
It is a huge difference between learning *programming languages* and learning *programming*.
If you can *program*, you can fairly easily switch language of the same paradigm. If you only focus on the languages, you definitely will trip switching languages.
You will need to learn to *Think Like A Programmer* (which happens to be the title of an excellent and highly recommendable book by *V. Anton Spraul* that I strongly suggest you give a read).
You obviously focused on churning out code instead of on *programming*, on creating the solutions.
You obviously also failed to learn to work with *documentation* (in case of JS, best the MDN).
I genuinely don’t like JavaScript, nor do I *want* to like it. I’ve been professionally programming for over a decade now and frankly JS makes my head hurt. I’ll happily write in Typescript and let the compiler convert that into JavaScript for me because I frankly cannot be bothered.
Unpopular Opinion but JavaScript is nonsense. I strongly recommend you go back to C#. We use [ASP.NET](http://ASP.NET) with Blazor at our company and have been able to build much more powerful software. “window.open” is about as much JavaScript I’ve had to write in my current project. I wrote code for generating a complicated excel report today, It has to get Data from the Db, format it and send it to the API url based on the user request. That was the last part of my first production app, I just have to do a few UX stuff still. I was in your position a few months ago. I cheated and looked at the source code for the calculator on TOP. But I copied the code by hand I made sure I understood each line, then I wrote my own CSS at least, but I didn’t give up. Stuff like loops and arrays are in every programming language. An array is really just a collection of values A string is an array of characters for example.. You can iterate through it ie do something for each value in the array, that’s one example of a loop, arrays in Csharp are immutable but in JavaScript you can add or remove values. In Csharp you have Lists instead for that. Python also has Lists. Dictionaries in Csharp is an Array of objects in JavaScript. Python also has dictionaries. You have like 2 types of loops really. A while and a for loop. A while loop runs while a certain condition is met and a for loop runs across a certain range, like for each item in an array. Or an iterator that you define and increment until an exit condition is met. This is stuff you have to know and it honestly gets much deeper than that. Just keep on writing code. Honestly, fuck the guides and tutorials. Just write code, even if it’s the dumbest shit, and look at source code, step through the debugger, see what it does. I honestly didn’t understand recursion for example until I ran the debugger and saw what it does. Don’t give up. Depending on how much time you spend coding per day, it might take you 3 to 6 months to 1 or 2 years to really understand this stuff.
Hot take: JS isnt a very good programming language but its what we get.
It _does_ do event handling and asynchronous stuff very well, though, which is why its still a good solution for handling web UI stuff.
But the only thing thats good about it for learning programming is that you can start writing it in your browsers console and don’t need any special software installed or configured.
if u had 2yoe with c# you would have 0 problems with the basics of js, but from how u describe things maybe u are just making up stories for reasons i dont understand🤷🏿♂
You are talking about JavaScript module on FreeCodeCamp, right? I know they changed it but it was hard enough when I did it months ago and I have some previous JavaScript foundation. Dont take it personally and try your best. I remember I just did the algorithms on VS Code to get some debugging.
Have realistic expectations. It’s a two to five year process to think programmatically. After that time span , you still won’t be done.
Javascript is very “syntaxic”, where you have to understand what non alphabetic characters mean. It’s in all languages, but older languages abuse this a lot.
You learn HTML and CSS, so JavaScript makes sense to you.
But, you may have more fun learning to program with Python.
I always had a hard time with JavaScript after coming from Python and C# as well. It finally clicked for me when I realized that as a web language, a lot of JavaScript relies on delayed data handling, so the whole app is wrapped around tons of event listeners that wait for something to happen or some data to be returned before running the function. You have to come at it with the understanding that the data you’re expecting isn’t always going to be there when you want it, so you have to wait for it and also handle instances where it might never come back. Order of operations become a lot more important to really understand, as opposed to something like C# where you could just follow the progression of function calls and be pretty confident that those functions will be there and return the values in a more reliable order.
For instance, setting up functionality for a button at the beginning of your code might fail because JavaScript runs your main script before the button is available. To handle this, you have to wrap the event listener for the button click inside a function which is an event listener that waits for the page to load. This ensures that the button is available in the DOM before attaching the event listener.
The difficulty is also exacerbated by how the web was developed over 40 years, so there is a ton of overlap and interplay between several scripting languages and requires a general understanding of how all of them operate together – at it’s core it’s HTML, CSS, and Javascript and expanded with hundreds of APIs and frameworks on top of that. There’s a ton of context switching between all of these different languages often within the same module but because they all work independently, it takes more effort to unify them in a cohesive way within your application.
For instance, you could have your HTML file with all of your elements within it, and styled by the CSS, but then you want some dynamic buttons to be loaded based on user input, so now within javascript you have to find the element you want to add to, add your buttons in javascript (which looks different than if you would add them in HTML), and then you could bypass the css altogether by adding additional inline styles to the buttons in javascript. And you also could have inlined some styles in your HTML. Now you have 3 places to look if you’re trying to figure out why a button looks a certain way.
So, if you don’t want everything to become a huge mess, you have to really be wary to be consistent in following a set of rules for how you want your app to function – not just because it won’t “compile” if you have an error, but because your app could be working great but then require a ton of extra effort to untangle when you want to change some basic functionality.
I don’t care what others say. JavaScript is and always will be a mess of a language that we should have replaced as the standard long ago but are now stuck with it forever because so much has been built on top of it.
Some devs seem to like working with it and probably enjoy adding yet another superfluous framework/package to the ever growing list in an attempt to make the language more usable.
I can do front-end development but JavaScript is why I focus more on the back-end typically. You should of course push through and learn as it isn’t going anywhere anytime soon.
Does anyone still use EcmaScript? Just use TypeScript. It’s way closer to C#.
What always worked for me when learning new language was googling the way to achieve what I want instead of memorizing everything. The case is most languages have similar syntax features and class collection support (for oop). What I would do is search for “js array remove element” (lang name, questioned type/ collection/ syntax feature, what you want to do) and find some stackoverflow answers (or maybe some mdn docs in case of javascript). Why I do this? Well it’s hard to remember every detail of language standard library. Learning how to search things in the internet is really the most beneficial. In case of js you quickly find ecmascript standards and snippets before ES6 and ES6+ (there’s many approach to the same problem and anything is good as long as you understand how this works).
Now onto javascript weirdness. It’s really built different (search for prototype chain if you are interested). Everything is an object – there’s not really a concept of type declaration either (things get interesting with this keyword in function contexts). Control flow statements such as for loop works almost the same as in other languages. What is not intuitive at all is that there are for in and for of loops (iterate over array values or object properties). Not going into more details as it is already long enough. Sometimes javascript feels very, very weird but this is one of my personal favorites. You can do many interesting stuff with the syntax itself and stretch “type” system in many ways. It somehow can improve your imagination and prepare better in case you want to switch language in the future.
I know my answer is all and nothing at the same time but I don’t want to take the fun of learning new things from you.
Javascript sucks