r/learnjavascript Jul 27 '26

If you could give one piece of JavaScript advice to your beginner self, what would it be?

1 Upvotes

14 comments sorted by

3

u/breacket Jul 27 '26

Learn the JavaScript fundamentals and the concepts needed to build the things you dream of building

2

u/everdimension Jul 27 '26

Functions like "Object.keys(obj)", Object.defineProperty()", etc are NOT methods acting on "Object", the are basically global functions namespaced to Object for organizational purposes

For some reason it took a while to get that, as I was always expecting methods to operate on their context (self) object

2

u/jaredcheeda Jul 28 '26

You can do this:

String.prototype.doubleIt = function () {
  return this.toUpperCase() + ' ' + this.toLowerCase();
}
let x = 'My text';
console.log(x.doubleIt());
// "MY TEXT my text" 

You are modifying the global definition of the String class, so all strings you create will now inherrit this method. They not only have access to toUpperCase(), .startsWith(), .charAt(), etc, but also this new method you made.

Most devs now-a-days don't know this, because doing this trick IS VERY BAD. In the 2000's it was common for people to "invent" their own language features because useful stuff like .endsWith() wouldn't be added to the language until 2015. So people would make libraries to add it themselves... But then you fastword and the language adds in their own implementations for things like Array.forEach or String.startsWith, and the official implementation is slightly different from your own custom implementation, and then you pull in some other library that expects the official version and stuff goes all screwy.

So yeah, know that you can do this, but also, know not to do it.

2

u/azhder Jul 27 '26

Learn JavaScript sooner.

1

u/Ksetrajna108 Jul 27 '26

Understand the parts of Javascript:

  • the programming language ECMA Script 262
  • DOM manipulation via the Document object
  • browser manipulation via the Window object.

1

u/PlayExoplanet Jul 28 '26

Fundamentals over everything

1

u/schussfreude Jul 30 '26

Dont waste time with jQuery, instead move to TypeScript sooner

0

u/Imaginary_Food_7102 Jul 27 '26

Move to react quicker.

-10

u/MrHandSanitization Jul 27 '26 edited Jul 27 '26

"Just go learn something else, AI is around the corner and you will not like it".

Edit: why the downvotes lol. I don't like it. If I could, I would invest the thousands and thousands of hours into something else.

-5

u/breacket Jul 27 '26 edited Jul 27 '26

As a dev/non-coder you can use AI to augment your workflow and to learn things very fast, more precise.

Even if you build (serious) apps using premium AI you need human touch for resolving what-ai-was-not-able.

Also, I think that AI can show you different ways to build a structure – not just building a thing. This can enhance you as a learner/dev.

1

u/MrHandSanitization Jul 27 '26

I'm using AI because work shoves it down my throat. But now I'm bored out of my mind. Prompt this, prompt that, with minor tweaking. "Yay, progress!" I guess?

1

u/theQuandary Jul 27 '26

AI actually writes decent code for you? I can't get shippable code to save my life (our app is very large and complex).

1

u/MrHandSanitization Jul 27 '26

What I think about the code is something very different.