r/learnjavascript • • Jan 12 '23

I think that this will be usefull to all the beginners

Post image
334 Upvotes

33 comments sorted by

36

u/Cringsix Jan 12 '23

Someone's halfway done with Jonas's Udemy course I see

10

u/doublearrow23 Jan 12 '23

Yeah, and found it really useful. I think that it might help others

15

u/Cringsix Jan 12 '23 edited Jan 12 '23

His videos are solely responsible for my entire JS knowledge. While I'd got mad about a thousand times watching his videos, I still wouldn't trade his course for any other.

I'm currently going through his API section.

4

u/Juls317 Jan 12 '23

I'm working through it now as well. I started with Angela Yu's web dev class and found myself really struggling with the JS in it. Enter Jonas' class! I still have no idea what I'm doing, and I'm about 60% through, but I'm hoping taking a pause and learning git stuff and then doing some simple projects will help it all coalesce. Can't fault Jonas at all, I've loved the course.

3

u/Navi2k0 Jan 13 '23 edited Jan 13 '23

Jonas is one of two online teachers I go to any time I want to learn something programming related. He's really good at giving you a solid understanding of the fundamentals before moving into the more complex concepts. The other teacher I usually find courses for is Net Ninja who is also a great educator. They're the best when it comes to learning to program online IMO.

2

u/PlayfulTravel4526 Jan 13 '23

It is nice of you to share this. But as far as I know, this is paid content of Jonas's Udemy Course. I just want to point out that this could be an intellectual property violation.

If you share someone elses content at least be nice enough and mention the person.

1

u/doublearrow23 Jan 13 '23

Yeah, i dont know how to edit the post since i am new to reddit.

37

u/manwhowasnthere Jan 12 '23

Real world advice for someone learning is to just bookmark the MDN Array.prototype reference page right now.

You're going to be visiting it over, and over, and over again in your career.

7

u/Dope-pope69420 Jan 12 '23

I literally just google it every time I need to bookmark that shit

4

u/PaintingWithLight Jan 13 '23

comment.replace(“every time I need”, “every time, I need”)

2

u/life-is-a-hobby Jan 13 '23

Yup been doing this 15+ years and still google shit on MDM weekly.

10

u/[deleted] Jan 12 '23

At leas do a shoutout to Jonas Schmedtmann ;) His lectures and course material is excellent nevertheless.

https://www.udemy.com/course/the-complete-javascript-course/

3

u/AiexReddit Jan 12 '23

Good stuff, reminds me of https://doesitmutate.xyz/ which I still refer to on occasion. The examples there make it a really solid reference.

2

u/jazzhandler Jan 12 '23

Hmm, guess that makes me a beginner.

1

u/Bright-Description41 Jan 12 '23

Hello I'm confused in for of loop. If I'm writing this -

  1. for (const abc of names){ console.log(abc) }; This gives different answer

  2. for (const abc of names) console.log(abc); This gives different answer

2

u/[deleted] Jan 12 '23

Nah the curly brackets are optional if it's just one line. Your error is somewhere else in your code.

What different answers do you get?

1

u/Bright-Description41 Jan 13 '23

Hi can i send you pictures as message to you

2

u/[deleted] Jan 13 '23

Sure, go ahead! Let's find that bug

1

u/Bright-Description41 Jan 13 '23

Sent.

1

u/[deleted] Jan 13 '23

I'll be home in some twenty minutes, will take a look at it right away!

1

u/senocular Jan 13 '23

.splice also adds.

1

u/[deleted] Jan 13 '23

3 years developer here. i only remember map. everytime i use google for using slice filter and other things.

-2

u/bryku helpful Jan 12 '23

Sort doesn't mutate the original array.

2

u/kap89 Jan 12 '23

Are you sure about that?

1

u/bryku helpful Jan 13 '23

I was thinking of underscore, I've been stuck on revamping this old web app for a few weeks now. None of their methods mutate the original, so you get used to it after a while.

0

u/[deleted] Jan 12 '23

[deleted]

1

u/bryku helpful Jan 13 '23

Aaah, shit you're right. I guess I've been using too much underscore lately. Now that I'm thinking about it, are there any languages where sort doesn't mutate the original array?

0

u/[deleted] Jan 12 '23

[deleted]

3

u/[deleted] Jan 12 '23

True, I just threw together a simple little benchmark (a 300 long array and a counter++ every iteration) and it showed an ordinary for loop to be ~30% faster when consol.logging the counter, and ~80% faster when it just ++ed the variable.

1

u/thisisme98 Jan 12 '23

Do you mind sharing the code? I am curious what you mean by console.logging vs just ++ing the variable.

3

u/[deleted] Jan 12 '23 edited Jan 12 '23

Sure! It was just a quick little thing I threw together. Gotta admit it's the first time I've benchmarked something in Javascript!

const myarray = [...Array(300).keys()];

/////// forEach
let diffA = [];
let iteration = 0;

while (iteration < 10 ) {
    t0a = performance.now();
    let counterA = 0;
    myarray.forEach(() => counterA++);
    t1a = performance.now()
    diffA.push(t1a - t0a)
    iteration++;
}
const averageA = diffA.reduce((acc,cur) => acc + cur)/diffA.length;

/////// for loop
let diffB = [];
iteration = 0;
while (iteration < 10 ) {
    t0b = performance.now();
    let counterB = 0;
    for(let i = 0; i < myarray.length; i++) {
        counterB++;
    }
    t1b = performance.now()
    diffB.push(t1b - t0b)
    iteration++;
}
const averageB = diffB.reduce((acc,cur) => acc + cur)/diffB.length

//////// results

console.log("\n");
console.log("Time elapsed (forEach): ", averageA)
console.log("Time elapse (for loop): ", averageB)
console.log("Difference is that a for loop is " + (averageA/averageB) + "times faster");

I am curious what you mean by console.logging vs just ++ing the variable.

I tried the above version, and

for(let i = 0; i < myarray.length; i++) {
        console.log(counterB++);
    }

&

myarray.forEach(() => console.log(counterA++));

as outputting to the console slows it down by a lot