r/learnjavascript • u/Sudden-Process8089-1 • 10d ago
I have a question about how to write my first JavaScript code
I am trying to lear JavaScript and having trouble any suggestion to websites that are helpful
2
u/IAmTheRedditBot 10d ago
you missed a second quotation mark thats why its failing.
If you still have trouble tell me what happened and i will explain what might be happening.
Hope this helps
2
u/Sudden-Process8089-1 10d ago
Thank you for your help. I noticed that and fixed it. I am sorry I am new to this. and trying learn more about programming.
6
2
2
1
u/Familiar-Advisor6846 10d ago
Go to javascript.info and read chapter 2. It is short, free, and the best explanation of variables and types I have seen
1
u/Discordbothost 9d ago
since your first bug was a missing quote, the thing that'll save you the most time is learning to read the error instead of the code. hit F12 in the browser, open the Console tab, and the red message tells you the file and line number, something like "Uncaught SyntaxError: ... (script.js:4)". go to line 4 and look just before that spot.
also write it in VS Code rather than notepad if you aren't already, it colors strings so an unclosed quote turns the whole rest of the line the wrong color and you spot it instantly.
for a site, MDN's "JavaScript first steps" is short and beginner friendly, javascript.info once you want the deeper why
-1
u/dontmissth 10d ago
I would first pick something you want to build. Following random tutorials never worked for me.
I started coding first because I wanted to edit my Myspace profile. Then my friend was in a band and needed a website. Then I just continued from there and do it fulltime
-2
6
u/Sweet_Onion4245 10d ago
I'd recommend starting with freeCodeCamp. It has interactive JavaScript lessons where you can actually write code and practise as you learn. javascript.info is also really good for understanding concepts with examples.
Start with variables, data types, conditions, loops and functions. Don't just watch tutorials, try writing small programs yourself. Even simple things like a calculator or a number guessing game can help a lot. Take it one step at a time!