r/learnjavascript • • Jan 24 '26

question about using ES6 classes.

1 Upvotes

pastebin

i was wondering, would this code be syntactically OK? i imagine there might be scenarios where you want all the functionality of the superclass method, but then you simply want to add more statements (more implementation) to it... could this work?


r/learnjavascript • • Jan 24 '26

Why can’t I see what’s in the multidimensional array?

1 Upvotes

This is my first time actually coding in javascript but I have experience in python and java. I am using Visual Studio Code and it is my first time using it.

I coded this very basic reduce function. The way I call this function results in a series of arrays. Everything other than the reduce function itself is provided to me by my teacher so I would perfer not to change it.

Here is the code:

const nums = [1,2,3,4,5];

const evensAndOdds = reduce(nums, (value, acc) => { if (value % 2 == 0) { acc.evens.push(value); } else { acc.odds.push(value); } return acc; }, {evens: [], odds: []});

console.log(evensAndOdds);

function reduce(data1, reducer, initialValue) { let reducedProduct = 0;

for (let element of data1) {
    let product = reducer(element, initialValue);
    reducedProduct += product;
}
return reducedProduct;

}

========================================================================== And here is the output:

0[object Object][object Object][object Object][object Object][object Object]

========================================================================= I want to be able to see the actual values. The example provided to me by my teacher says the result should be //{evens: [2,4], odds: [1,3,5]}; I understand my code could be wrong but I wont really know unless I can see the actual values.


r/learnjavascript • • Jan 23 '26

Why is JavaScript so hard to learn? Beginner projects don’t feel beginner

53 Upvotes

I am learning JavaScript and honestly feel like I am losing my mind. I have watched a lot of tutorials but even the ones labeled beginner skip fundamentals or explain things using jargon without really breaking concepts down. I can follow along but I do not truly understand what I am doing.

I can build simple things like a counter or a color flipper from scratch and those make sense. But I tried building a to-do app today and it feels insanely complicated. Everyone says it is a beginner project, yet every tutorial introduces a ton of concepts at once and I feel completely overwhelmed.

For context, I have a STEM degree and learned HTML and CSS pretty quickly. JavaScript, especially anything involving data or backend logic, feels abstract and confusing. People say just keep building, but the issue is understanding what I am building and why it works. Even when I ask AI tools to explain things simply, it still does not fully click.

For those who self taught JavaScript, how long did it take before you could build a simple CRUD app on your own and actually understand it? Is this frustration normal, am I missing something fundamental or maybe I just have a low IQ?