Getting started with Javascript

I am currently learning responsive web design and "mobile-first" development, and it looks like I need to finally break down and learn Javascript. My approach to learning new languages is to learn the pure language before getting off into the weeds learning frameworks and so on. Is it possible to learn just Javascript? And is there a certain version of Javascript I should learn? (Many years ago I recall there being a fork maybe between JavaScrpt II and JavaScript 6 or something like that and all I remember is that it mattered which path you took. Right now I just need to learn enough JavaScript to help with mobile issues like hamburger menus, menus coming in from off screen, and other mobile "metaphors" that can't be done with just HTML and CSS. P.S. I am new to Discord and not really familiar with how it works - I am an old dog used to online user forums and BBCode - so sorry if I'm not doing this correctly!
141 Replies
Doksuri
Doksuri3w ago
Is it possible to learn just Javascript? => totally !!! and i'll add : it's the correct approche when learning JS. "vanilla JS" then choose a framework as for the versions : look for ES6 and higher many modern features were added from there
ἔρως
ἔρως3w ago
and with es6, there was a HUGE set of changes we got classes, fat arrow functions, await promises and so much more just make sure you get familiar with how data types work and the basic javascript syntax
McMarty
McMartyOP3w ago
I am glad to hear that! (In the past some many strangers online have been trying to FORCE ME to learn frameworks and I don't understand why?!) What version of raw Javascript is being used in 2024? (I thought ES6 was from like 10 years ago?) I find how JavaScript is described as confusing... I am used to things like HTML5, CSS3 - although that is a bad example afte rthe fork, PHP5, and so on. Okay, so another dumb question(s)... Is Javascript something I have to install, or is it just there? Like I was pondering this the other day... Where does HTML exist? Where does CSS exist? The best I can figure is that browsers come pre-loaded with things like HTML, CSS, and Javascript? I ask because since I know nothing about Javascript, and I want to learn pure Javascript, I need to know how to get it so I can start coding in it. As some background, I am a Mac guy, and in the past I used MAMP as my PHP and MySQL webserver for dev. I have been away from coding for like 10 years, and my dream is to build a mobile e-comemrce site - for my startup - and to code it in HTML5, CSS3, maybe a little Javascript, and maybe switch to Python. If I can keep using MAMP that would make my life much easier...
ἔρως
ἔρως3w ago
it's just there, in the browser when you do <script> or <script src="filename.js">, the code simply runs what you may need, way later on, is node.js or bun, but that's WAAAAAAAAAAAAAAAAAY later
McMarty
McMartyOP3w ago
So browsers know how to process HTML, CSS, and JS all by themselves? So they have built in interpretors?
ἔρως
ἔρως3w ago
yup and that has been the case for almost 30 years
McMarty
McMartyOP3w ago
A ha That being said, then what version of Javascript would be built into Firefox and Chrome (and maybe Edge) in 2024?
ἔρως
ἔρως3w ago
i think they switched up the names, and im not sure about it but you should learn es6 and newer
McMarty
McMartyOP3w ago
What would be newer? Is there ES7? 🙂 (What does "ES6" stand for?
ἔρως
ἔρως3w ago
es6 means "ecmascript 6" but you may see other names like "es2015" you might also see "tc39"
Sleep Twitch
Sleep Twitch3w ago
Just search online for what you want your script to do and how to do that in javascript. If you find a recent answer, it probably uses recent features of javascript. Isn't MAMP a php server? So.. I would probably advise you to determine what tech stack you want to use... the web world has changed a looooooot since > 10 years back. Do you want to use php, or do you maybe want to use serverless / edge functions for you backend. If you want php, maybe laravel would be better to learn than javascript. If you just want to quickly setup a webshop, maybe something like Shopify would be better.
McMarty
McMartyOP3w ago
What version of Javascript would the latest version of Firefox and Chrome support? (Is there a way to find out?)
Sleep Twitch
Sleep Twitch3w ago
They all support the latest stuff It's mostly css that has features not all browsers support
McMarty
McMartyOP3w ago
MAMP is like LAMP with M being Mac. Yes, it is a webserver that supports PHP and MySQL so when MAMp is installed, I can write code in NetBeans, and then press (?) Shift + F6 I think, and I have a live page served up in Firefox. No fiddling with Sys Admin stuff that id ont know I am thinking of shifting to Pythin, but I need to do some more reseach - and get some reassurance that i wont regret that! 😉 Yeah, but Shopify is cheating. I want a home grown site that I build and can make it mine
Sleep Twitch
Sleep Twitch3w ago
If your goal is to have a succesful website for a successful business, then it isn't cheating. If learning how to build a website yourself is a higher priority, then maybe yes.
McMarty
McMartyOP3w ago
(Sorry for delay - at work!) 😉 So because I am old-school and like paper, what books could I read to learn the basics of Javascript. Just make sure the book is written about ES6? I want both! LOL
Sleep Twitch
Sleep Twitch3w ago
I mean.. if your business isn't selling anything because you don't have a webshop and you need lots of time to learn to build an ecommerce site (with payment integrations, maybe also shipping etc..) than maybe it is better to quickly set up a shop in an easier tool like shopify. And if you really want to build your own site, you can do that while the shopify (or other simple storefront framework) shop is making your business money No customer will care which technology you used to build your webshop. They care whether your shop works easy and whether they can easily find what they are looking for. That's the only thing that matters.
McMarty
McMartyOP3w ago
You are a wise man
Sleep Twitch
Sleep Twitch3w ago
Using node.js and an editor like VSCode (most used I believe), you can quickly setup a server as well. Also.. lots of tutorials for webshops built with nextjs or another js framework.. if you really want to use php, I could recommend laravel
ἔρως
ἔρως3w ago
currently, es2023
McMarty
McMartyOP3w ago
How much has JS changed between ES6 and ES2003? because I like reading paper books, is there a publishing year that I should shoot for? I mean like, newer than 20xx (I do refer to online sources like MDN and w3.org but I find reading EDITIED printed books works better for me)
ἔρως
ἔρως3w ago
2003 or 2023?
McMarty
McMartyOP3w ago
Oops. (I thought was old!) Okay, let me re-phrase... If I read a (paper) book on Javascript like from A Book Apart or O'Reilly or whatever, and it was from say 2014 - would that be a problem to learn the basics? Or is JS from 2014 out-of-date?
ἔρως
ἔρως3w ago
some syntax didnt exist then for example, for(let x of obj)
McMarty
McMartyOP3w ago
I prefer published books first, because they have editors, and I always fear I'll get bad info online. Plus I find most printed books do a better job explaining things
ἔρως
ἔρως3w ago
be careful: some things added in 2014 have been deprecated
McMarty
McMartyOP3w ago
What year would be a good cutoff?
ἔρως
ἔρως3w ago
2024 no, wait, 2025
Sleep Twitch
Sleep Twitch3w ago
To be honest.. online other people can comment and vote what is the best answer like on stack overflow, so that may give you better solutions than something 1 guy wrote
McMarty
McMartyOP3w ago
A little extreme don't you think?
ἔρως
ἔρως3w ago
not at all back then, you didn't had mutation observers, and had to rely in weird events
Sleep Twitch
Sleep Twitch3w ago
That's how fast the javascript world changes. At least the framework world.. it seems every week a new one arises
ἔρως
ἔρως3w ago
you didn't had intersection observers you didn't had iterators
McMarty
McMartyOP3w ago
I agree, but I learn better reading books to start. (I read 4.5 books this weekend, and I guarantee that 3 of them were superior to most things I'd find online.)
ἔρως
ἔρως3w ago
or even async/await
McMarty
McMartyOP3w ago
Sounds like COVID... 😉
ἔρως
ἔρως3w ago
get a recent book for christmas
Sleep Twitch
Sleep Twitch3w ago
And find some good online tutorials and print them if you like reading from paper better By the time a book comes out, it is almost already out of date if you want cutting edge stuff
McMarty
McMartyOP3w ago
I guess what I am saying in a nice way, is that geeks often don't explain things very well. (I'm going to use my CSS3 book as a door stop!) Okay, here is a key point... I don't want cutting-edge. I want to gain knowledge of core JS
ἔρως
ἔρως3w ago
seriously, 2024
McMarty
McMartyOP3w ago
Then after I feel comfortable with that, I can go online and get the latest and greatest
ἔρως
ἔρως3w ago
there's plenty of basic things that didn't exist before but make you a much better dev
McMarty
McMartyOP3w ago
But back to the beginning of the converation, you agree learning pure JS would be a good place to start?
ἔρως
ἔρως3w ago
yes
Sleep Twitch
Sleep Twitch3w ago
Maybe not make you a better dev per se, but it does make your life easier as a dev
ἔρως
ἔρως3w ago
the example of the for ... of loop is one that does make you a better developer
Sleep Twitch
Sleep Twitch3w ago
If you ask me.. you don't need to know every in and out of vanilla js to make a relatively simple website. Also, lots of stuff is made a lot easier by frameworks, like routing, signals for reactivity, making reusable components and so on. You don't need to know how to wash your cloths by hand if you have a washing machine at your disposal.. use the tools that can make your life easier
ἔρως
ἔρως3w ago
that is true, but learning how to walk before you face-plant yourself into being a mediocre react developer that doesn't know what a .map does is very important im not saying that that's what will happen, but ive seen things
Sleep Twitch
Sleep Twitch3w ago
True, you need to know the basics, but you don't really need to read a complete book before actually start to work on something. Learning by doing often works the best is my own experience at least
ἔρως
ἔρως3w ago
true
McMarty
McMartyOP3w ago
But isn't that the exact opposite advice you gave earlier about learning pure JS first?
ἔρως
ἔρως3w ago
there are things you probably will never use, like prototype bs, symbols and things like that
Sleep Twitch
Sleep Twitch3w ago
I wouldn't choose react at all if you don't need it to find a job as a dev, but that aside..
McMarty
McMartyOP3w ago
And doesn't that prove my point about reading a good book from a good author (aka "teacher") about JavaScript would help me to get me bearings?
Sleep Twitch
Sleep Twitch3w ago
You need to know the basics, but you don't need every last function and weird thing javascript can do.
McMarty
McMartyOP3w ago
I agree, so shouldn't any book in the last decade address that? (I have no issue buying a JS 2024 book, but I am trying to find a coule of books from A Book Apart since I know they are high quality)
ἔρως
ἔρως3w ago
not really
Sleep Twitch
Sleep Twitch3w ago
No... since a lot of basic stuff is made much easier with new features
ἔρως
ἔρως3w ago
and depending on the year of the book, basic things may be completely outdated or deprecated or even removed
McMarty
McMartyOP3w ago
If you are game, maybe it would help to explain what I am trying to do?
Sleep Twitch
Sleep Twitch3w ago
That always helps
ἔρως
ἔρως3w ago
yeah, explain it
McMarty
McMartyOP3w ago
So I wrote a pretty elaborate website (~60,000 lines of code) and then the pandemic hit as I was finishing up he ecommerce module. All of it was handcoded - no frameworks I was proud of the website, BUT it isnt responsive so basically useless in 2024 Since I have to start from scratch, I g=figure now would be a good time to learn to be a better coder and fill in gaps like learning JS
ἔρως
ἔρως3w ago
sounds reasonble and noble so far
McMarty
McMartyOP3w ago
I think what is a reasonable appraoch is to start off with a static website of HTML, CSS, and maybe some JS
Sleep Twitch
Sleep Twitch3w ago
Responsiveness is mostly css related though..
ἔρως
ἔρως3w ago
no no, it's 100% now-a-days
McMarty
McMartyOP3w ago
My startup is an online newspaper, and to try and recode what I had will take a long time - mainly because I havent coded in like 8 years So I feel I could code something with just those technologues to get my content out there and make a name for myself while i work on making it database driven
Sleep Twitch
Sleep Twitch3w ago
So your website could be made responsive, just by changing the css, maybe needing to add a div here and there
McMarty
McMartyOP3w ago
In theory, writing a responsive site shouldn't be too hard - since it won't be monetized in v1.0 No it couldn't. I know my code (and design) and it would be a nightmare. Classic "sunk cost" where you have to know when to cut your losses
ἔρως
ἔρως3w ago
sometimes, a re-write is better specially an old brittle layout
McMarty
McMartyOP3w ago
My code ran well, but all of teh HTML and CSS and PHP were intermingled and even if I could snap my fingers and go 100% responsive tomorrow, it isn't manageable moving forward I want to learn to be a better coder Write good code, modular code, reusable code, easy to understand code being a one-man show, being quick and agile is key to me succeeding So me not going live may have been a blessing Because this will fore me to get things right this time
Sleep Twitch
Sleep Twitch3w ago
So basically you want to split frontend and backend probably. That would make it easier to separate responsibility
McMarty
McMartyOP3w ago
And over my 4-day week and reading 4 1/2 books, I am 1000% certain - mostly die to Information Architecture - that now is the time to start over Exactly I bought digital subscriptions to the Wall Street Journal and Bllomberg this weekend. Whenever I take study breaks, I look at those papers on my iPhone and see how things work, what I like, what I could do better, and hope to use those as guides For a static site, really all I need to start is a good home page and section pages and article template
Sleep Twitch
Sleep Twitch3w ago
Always good to check the competition, see what they do right and what you could improve.
McMarty
McMartyOP3w ago
That is enough to allow me to get publishing... I report on privacy, security, and misinformation and everything going on in the world relates to what I do Do you know how frustarting it was when I was out doing video interviews and went to show people my splash page - which used the same approach as my main site which I took down - and the had to scroll to the rigth on their phones to see a link to my YT channel? I'm sure i lost 85% of potential followers So I need a mobile-first solution that keeps peoples crolling and not leaving And I think HTML, CSS, and a little JS is enough to get me started
ἔρως
ἔρως3w ago
with good css, you probably won't need javascript
McMarty
McMartyOP3w ago
And from a technology standpoint, I want to use JS as a last resort. I have seen demos on YT of a hamburger menu and slide out (name??) using pure CSS3 and it looked good
Sleep Twitch
Sleep Twitch3w ago
If it just needs to be a static site, so no user data like comments and user profiles and such, than I would recommend using Astro. It is a really easy framework for static (and dynamic if you like) website and the blog template you can use when you start a new astro project basically has all you need probably
McMarty
McMartyOP3w ago
I think I mainly need JS for some of the mobile stuff and maybe for client-side validation - even though I will do server-side once that part is hooked up (Which is why i still feel like even a book from 2014 is likely good enough for now.) But a coupel lines of pure JS would do the same for now, right?
clevermissfox
clevermissfox3w ago
Reading and tutorials is excellent but make sure you’re practicing the concepts during/right after too. Realized that I would read or watch a tutorial about a concept, think i get it and it’s clicked but when i actually sat down at the keyboard i don’t know where to start. It’s also recommended to code along with a tutorial , then delete all the code and rebuild it from memory , scrub through to find the part you need if you get stuck; then delete and build again; then delete it and wait a few days; rebuild from memory in the following 3-5 days. Repetition and practice is crucial to building the muscle memory. It took longer than I expected to wrap my brain around the syntax; I still remember being so defeated looking at a line of code like
el.addEventListener(‘click’, () => {…})
el.addEventListener(‘click’, () => {…})
All the symbols and opening and closing parentheses really didn’t make sense to my brain 😵‍💫
Sleep Twitch
Sleep Twitch3w ago
Why would you need js for the mobile stuff?
ἔρως
ἔρως3w ago
the menu which can be done with pure html
Sleep Twitch
Sleep Twitch3w ago
Exactly
McMarty
McMartyOP3w ago
What I mean is for a mobile-first, responsive site, things like clicking on a hamburger menu and then a menu sliding out from the left could be done with JS. Or if I had a bottom nav and wanted it to hide when you scroll down to read an article but appear when you scroll up, that requires JS
Sleep Twitch
Sleep Twitch3w ago
It is not the 2000s anymore when you needed js for everything other than just showing pure text and images
McMarty
McMartyOP3w ago
I agree, if I can do all of it in HTML and CSS I will But never having learned JS is a liability, and I might as well add it to my skills list. Plus for v2.0 when I need client-side validation and fancier stuff, then i will have that foundation
ἔρως
ἔρως3w ago
you should be able to do about 80-90% without javascript
McMarty
McMartyOP3w ago
Hopefully
ἔρως
ἔρως3w ago
as an exercise, you can implement html+css stuff in pure js re-inventing the wheel isn't always bad
McMarty
McMartyOP3w ago
I was suppsoed to finish setting up my VOIP on my new laptop today, but alas I am loitering here! I have some administrative stuff I need to get done, but once I have my new laptop set up and I know if I can still use MAMP, then I hope to get back into coding mockups Isn't that what the fancier frameworks do? (Forget the names)
ἔρως
ἔρως3w ago
not at all
Sleep Twitch
Sleep Twitch3w ago
I think marty means jsx
ἔρως
ἔρως3w ago
that's a hack on top of js to allow html items in it
Sleep Twitch
Sleep Twitch3w ago
If you only have a static page, you don't need Mamp, that's for running php
McMarty
McMartyOP3w ago
I meant the JS flavors that do backend - that can build "one page apps" Touche But I need to get MAMP set up on my new laptop to get my head back into what I did, and to see if I can maybe get Pythn served up in it Ultimately I need to get a database driven website up soon, because the end goal is to make some $$$ But for me, I want to believe, that the frontend conversion to mobile-first will be the hard part I guess I could just get NetBEans set up and use that if I am just doing HTML and CSS
Sleep Twitch
Sleep Twitch3w ago
Learn about the css features flexbox and grid. If you know those, responsiveness is way easier
McMarty
McMartyOP3w ago
I was jsut getting into Flexbox when the pandemic started. I was studying it this weekend in one of my new books. I ordered a book on Grid but alas it is stuck somewhere
Sleep Twitch
Sleep Twitch3w ago
I never heard of netbeans, but I am a windows guy. I use vscode, that seems the standard nowadays
McMarty
McMartyOP3w ago
Of course there is online resources and YT, but again, I find book provide better uality when you need a solid foundation. Netbeans is an IDE originally desigend for Java, but Iyou can code PHP in it as well as C++, C#, and I thik Pythin
Sleep Twitch
Sleep Twitch3w ago
Honestly, don't read too much. Just use them. The only way you will learn.
McMarty
McMartyOP3w ago
It's a fine balancing act. Where are you guys (or gals) located?
Sleep Twitch
Sleep Twitch3w ago
The Netherlands
McMarty
McMartyOP3w ago
cool Have you seen or used hamburger menus and pop out menus that use jsut CSS3? (What do you call the thing that slides out from the side what is like a full-screen menu?)
Sleep Twitch
Sleep Twitch3w ago
Sidebar i guess
Sleep Twitch
Sleep Twitch3w ago
Here is an example (haven't checked the code) https://codepen.io/erikterwan/pen/grOZxx
Erik Terwan
CodePen
Pure CSS Hamburger fold-out menu (right side)
I came up with this idea to use the :checked selector to activate a hamburger menu. This is it, no js to toggle a class....
McMarty
McMartyOP3w ago
How do I run that? I just see code
Sleep Twitch
Sleep Twitch3w ago
No description
Sleep Twitch
Sleep Twitch3w ago
I see this when I open it On my phone
McMarty
McMartyOP3w ago
No description
McMarty
McMartyOP3w ago
Do I need an account?
Sleep Twitch
Sleep Twitch3w ago
No, I am not logged in The message says the code has an issue with a href, have you accidentally changed something?
McMarty
McMartyOP3w ago
No, maybe a Firefox extension is causing an issue? Do I have to allow ads?
Sleep Twitch
Sleep Twitch3w ago
Maybe. Anyway, you can just google pure html css hamburg menu sidebar and you will find examples Don't think so. I use Brave as a browser and that aggressively blocks ads
McMarty
McMartyOP3w ago
I tried it in Chrome and see how it works. I assume that can be customized to go to other webpages and adjust how big the popout is I have uMatric and NoScript in Firefox
Sleep Twitch
Sleep Twitch3w ago
To make the popout / sidebar full screen is just change the #menu part of the css. Change the max height, max width, width and height properties
McMarty
McMartyOP3w ago
So it is customizable
Sleep Twitch
Sleep Twitch2w ago
Why wouldn't it be, it is just html and css And that is the whole idea of codepen.. to easily show other people examples of pages or components you made in html css and vanilla js
McMarty
McMartyOP2w ago
So you can view it logged out but to publish code you need an account?
Sleep Twitch
Sleep Twitch2w ago
Again, it is just html, change the url in the hrefs and it goes to a different page Yes
McMarty
McMartyOP2w ago
Is CodePen free to sign up?
Sleep Twitch
Sleep Twitch2w ago
I think so
McMarty
McMartyOP2w ago
So I gues that would be good for me to have when I'm askingf or help?
Sleep Twitch
Sleep Twitch2w ago
Yes, sites like this (stackblitz, codesandbox) are mentioned in https://discord.com/channels/436251713830125568/1134496810354888836
McMarty
McMartyOP2w ago
This is really annoying that Codepen won't work in FF
Sleep Twitch
Sleep Twitch2w ago
Probably the noscript extension?
McMarty
McMartyOP2w ago
I approved everything including buysellads.com Doesn't even work in a private FF window
Sleep Twitch
Sleep Twitch2w ago
It does work in FF mobile for me
McMarty
McMartyOP2w ago
I think that is a cue from the Heavens to get back to working onmy migration to my new laptop! Thanks for the help today
Sleep Twitch
Sleep Twitch2w ago
Good luck with your endeavours
McMarty
McMartyOP2w ago
Hopefully you all will be around in the future because I certainly could use the help!
Jochem
Jochem2w ago
I use it in firefox every day
Jochem
Jochem2w ago
No description
McMarty
McMartyOP2w ago
Well something is clearly broken I have tried everything
ἔρως
ἔρως2w ago
you can use jsfiddle the auto-complete is absolute shit, but it works
McMarty
McMartyOP2w ago
i just typed in the URL above on my brand new MacBook pro and same issue in Firefox WTF? In Firefox, I run uMatrix, NoScript, AdBlock Plus, Privacy Badger, and Decentralize. Under FF Preferences > Privacy & Security > Enhanced Tracking Protection, I have "Strict" chosen, but I whitelisted "https://codepen.io"
ἔρως
ἔρως2w ago
codepen pages are executed from a different domain, if im not mistaken
McMarty
McMartyOP2w ago
@Sleep Twitch posted this URL yesterday... https://codepen.io/erikterwan/pen/grOZxx
Erik Terwan
CodePen
Pure CSS Hamburger fold-out menu (right side)
I came up with this idea to use the :checked selector to activate a hamburger menu. This is it, no js to toggle a class....
McMarty
McMartyOP2w ago
It works in Chrome on both my old and new MBP's, but I am getting no preview in Firefox on either laptop Come to think of it, I recall during the pandemic that CodePen suddenly stopped working Is this a Firefox issue or a Firefox extension issue? (I hate Google, so it's Firefox or nothing, and I think having CodePen in my toolbelt would help a lot - especially getting help here!)
Doksuri
Doksuri2w ago
you can't just "ignore chrome"... numbers don't lie... a large audience use chrome... => you ca dev/test with firefox everyday. and once a feature is finished, test it with chrome
McMarty
McMartyOP2w ago
I didn't say that I don't test in Chrome... Just because I test for Chrome doesn't mean I have to user it!! This CodePen thing is driving me crazy!! It has to be something obvious. Any ideas?
Want results from more Discord servers?
Add your server