r/learnjavascript • • Aug 08 '26

10 JavaScript questions that came up in almost every frontend interview I sat this year

312 Upvotes

I've been interviewing for frontend roles (SDE-2, around 4.5 years experience, React and Next.js) over the last few months and sat through a fair number of loops at product companies and mid-size startups. I kept a running doc of everything that got asked so I could spot patterns. Ten questions came up often enough that I'd now treat them as near guaranteed.

Sharing in case it saves someone else the trial and error.

  1. Implement debounce from scratch, then explain when you'd use debounce vs throttle. This one showed up in almost every single loop, usually as the warm up before harder coding.

  2. Closures. Not just the definition, but where you use them in React and the classic closure-inside-a-loop output question with var vs let.

  3. Hoisting, and how it differs from closures. Usually followed by var vs let vs const and when you actually hit a ReferenceError.

  4. The event loop. Call stack, microtask queue, macrotask queue, followed by predicting output from a snippet mixing setTimeout and Promise.then.

  5. The this keyword. Normal vs arrow functions, and what happens when you detach a method from its object. const a = obj.getName; a()

  6. Prototypal inheritance and the prototype chain, and how it differs from class inheritance.

  7. Deep copy vs shallow copy. Explain the difference, then implement a deep clone. Interviewers usually push on why JSON.parse(JSON.stringify()) is not good enough.

  8. Flatten a nested array, first without Array.flat() and then with it.

  9. Promise vs async/await. When you prefer each, and how error handling actually differs between them.

  10. Event delegation. Why it exists and how you'd apply it to a list with thousands of rows.

Two things that surprised me. Polyfills for call/apply/bind and the Promise combinators came up far less than the prep content online suggests. And output prediction questions were much more common than I expected, often used as a filter before anyone let me write real code.

Curious whether this matches what others have seen recently, or if it's specific to the kind of companies I was talking to.


r/learnjavascript • • Nov 17 '25

Why NaN==NaN is False in JavaScript ???

150 Upvotes

Anyone explain??


r/learnjavascript • • Jan 26 '26

A nice site for beginners learning JavaScript.

124 Upvotes

Recently came across this resource and thought it was awesome.

https://www.basiccodingconcepts.io/


r/learnjavascript • • Sep 11 '26

Some useful JavaScript features we often overlook - I wish I knew them earlier.

102 Upvotes

The deeper I get into JavaScript, the more I realize that knowing syntax isn't enough. There are small language features and behaviors that can save you from a lot of unnecessary code or some really confusing bugs.

A few that I think are worth knowing:

1. structuredClone() for deep copying

This is especially useful when working with nested objects. Simply assigning an object doesn't create a copy. For example, a common mistake is thinking this creates a completely independent copy:

const user2 = user1;

It doesn't. Both variables reference the same object.

With:

const user2 = structuredClone(user1);

you get a deep copy, so changing nested properties in user2 doesn't modify user1.

Example:

const user1 = {
  name: 'John',
  address: {
    city: 'Dallas'
  }
};

const user2 = structuredClone(user1);

user2.address.city = 'Austin';

console.log(user1.address.city); // Dallas

2. ?. + ?? together can prevent a lot of defensive code

Optional chaining prevents errors when something doesn't exist. For example:

const city = user?.address?.city ?? 'Unknown';

Instead of:

const city = user.address.city;

Which if user, address, or city doesn't exist, you don't get a TypeError, and you get 'Unknown' instead.

?? only falls back when the value is null or undefined.

3. console.table() for debugging

This is extremely useful when debugging arrays of objects. For instance:

console.table(users);

is often much easier to read than:

console.log(users);

Especially when you're dealing with things like product IDs, quantities, prices, etc. The data is displayed in a table format by the browser console. Therefore, making it much easier to inspect the arrays.

For example:

const users = [
  { name: 'John', age: 25 },
  { name: 'Mary', age: 30 },
  { name: 'Peter', age: 22 }
];

console.table(users);

4. Set for keeping values unique

It's a very simple and easy way to remove duplicates. For example, suppose you have:

const numbers = [1, 2, 2, 3, 3, 4, 4];

Instead of handling this with a complicated loop, you can use:

const uniqueNumbers = [...new Set(numbers)];

console.log(uniqueNumbers);
// [1, 2, 3, 4]

These features may seem simple, but I believe they can become much useful when you're building real projects. What JavaScript feature or behavior did you learn late that made you think, 'How did I not know this earlier?'


r/learnjavascript • • Jul 24 '26

5 years writing JS professionally. Still blank on interview questions sometimes

88 Upvotes

Not a junior dev problem. I've shipped plenty of gnarly JS/Vue code, no issues. But throw me in an interview and ask something like "explain event delegation" cold, no code editor, no context, and there's this half-second where my brain just stalls, like the info is there but the retrieval path isn't warmed up.

Realized it's not a knowledge problem, it's that I'd never actually practiced saying these answers on demand, but only reading about them or using them implicitly in code.

Built a small spaced-repetition app for this. Same idea as Anki, tracks what you keep fumbling and resurfaces it more.

Curious if this "I know it but can't produce it on command" thing hits other experienced devs too, or if I'm just built different (badly).

What worked for you all ? Mock interviews, flashcards, just doing more interviews to get reps in, something else?


r/learnjavascript • • Aug 31 '26

how would i hide an api key in a frontend setting such as neocities?

86 Upvotes

hey. i made a page on my neocities website where i put reviews of movies and books. for that i used google books api and imdb api

however, idk how i would hide this since anyone can download my website at any time?

i also wanted to automate the process of updating the changes i make to neocities, but for that id need to publish all files in a public github too. so idk how i would hide it there either.

any help?


r/learnjavascript • • Dec 08 '25

Free Mentorship in Software Engineering

85 Upvotes

Hi everyone,

I'm a senior frontend developer with a several years of commercial experience, working with React, Next.js, and TypeScript. Before tech, I spent 5+ years as a prosthetic dentist — so I know firsthand what it takes to make a major career switch.

Throughout my transition, I received support from other engineers that made a real difference. Now I want to pay it forward by offering free mentorship to anyone who needs it.

Some topics we can cover during our 30-minute weekly calls:

  • How to transition into software engineering

  • Strategies for career growth and development

  • Technical challenges or problems you're facing

  • General advice and feedback on your work

If you're thinking about getting into tech or feel stuck in your journey — DM me and I'll send you a link to book a call. Looking forward to helping you move forward!


r/learnjavascript • • Jul 27 '26

what's one JavaScript mistake every beginner should avoid?

82 Upvotes

If you could give one piece of advice to someone learning JavaScript today, what would it be?

It could be about:

  • Learning fundamentals

  • Debugging

  • Async code

  • DOM manipulation

  • Functions

  • Projects

Curious to hear what experienced developers wish they'd known earlier.


r/learnjavascript • • Aug 27 '26

When is it a good time to move from Javascript to learing React

65 Upvotes

I've been learning how to code for 2 months now and have made a few projects on my own. I've made a to-do list, Pomodoro timer, RPS game, coin-flip game and bunch of other stuff now. I've covered the Javascript basics like arrays, loops, if-statements, booleans, DOM, functions, variables and math.

I am now capable of building simple web apps on my own without a tutorial due to me taking breaks here and there to test myself. I still haven't finished the course yet but I want to know if I can move on from it yet. I do know Git, modules and external libraries.

I'm using roadmap.sh as a guide on what to tackle and what to learn at each step of my journey but since I'm 70% through the course and I can build basic apps on my own so should I move on to learning React.

Should I stay or finish the course. Btw it's a free 22hr Javascript course by SupersimpleDev his an AMAZING teacher and the course has a total of 250 exercises which help me practice each lesson I've learnt


r/learnjavascript • • Jun 29 '26

People who actually learned JavaScript, what study method worked best for you?

64 Upvotes

I’ve already learned HTML and CSS, and now I want to start JavaScript. I think it’s the obvious next step unless there’s a better path.
The thing I’m struggling with isn’t JavaScript itself—it’s how to learn it.
For HTML, I watched a 6-hour course. For CSS, I watched an 18-hour course and spent another 6–7 hours asking ChatGPT questions whenever I got stuck. I learned a lot, but it also felt painfully slow.
Sometimes I feel like I’m spending more time learning than actually building things, and that kills my confidence because I feel like I’m not making real progress.
My goal is to build apps without relying on vibe coding. I’m completely okay with using AI to explain concepts, review my code, or help me debug, but I want to actually understand what I’m writing.
So if you were starting JavaScript from scratch in 2026, what would you do?
Would you watch one long course or learn through projects?
Any YouTube channels or courses you’d genuinely recommend?
If you had to learn JavaScript all over again, what roadmap would you follow?
I’d rather hear from people who actually learned it recently than just get a random course recommendation.


r/learnjavascript • • Sep 28 '26

Best source to learn Java script for a very dumb idiot

59 Upvotes

So I am in college for graphics and game design and I am having hell learning it for visual code studio

I have to least get a D to pass and graduate but having hard time learning with ADHD and the overwhelming amount of code combinations.

Hoping someone has easy guides on learning this that is very simple to understand.


r/learnjavascript • • Apr 06 '26

The best way to learn, is by doing (my background story)

58 Upvotes

Hi there!

I'm a JavaScriot and TypeScript developer with 11 YOE and have worked at big tech companies like banking, telecom, cryptocurrencies.

For anyone who's just starting this journey and has just started understanding what a variable is, let me tell you a little story.

Over 15 years ago I used to be quite a gamer and played web-based mafia games where you could perform actions with a click

It was such a hype among the young ones around us. I had some great ideas for improvements and it made me curious if I could make it myself.

I didn't open a single how-to book, neither did I study anything, I simply googled a copy of a similar web-based game.

Once I looked at it I saw a bunch of HTML files and a bunch of PHP files.. Didn't know what to do with them so I looked up a tutorial how to get it running and asked around in forums.

Images werent loading, page looked awful but I actually had it running!

Then I was excited about adding some of the improvements, I saw a bunch of text and didn't know anything about it. I just searched for the text of the page and once I found it I made adjustments. I refreshed the page and boom! My new text appeared!

I was curious about how I can make it more adventurous with multiple click actions.. I got excited and wrote down all the story line text. And then came the functionality.. Oh boy have I seen many php errors!

I saved multiple copies of the code every time I made a change just to make sure I wouldn't fuck up the last change like I did many times before!

I didn't know what a variable is but I already knew how to use it. I saw some if code and knew this was a conditional thing.

Over time as I customized the code more and more I moved from building stuff to actually understanding code

I started reading w3schools docs, tried out a bunch of stuff, and got better over time, my ego was quite high and I thought I knew it all after 6 months of development..

Oh boy was I wrong.. I entered the startup scene and I've been faced with many additional things to understand. Asking why I'm doing it that way, why he didn't understand my code, how to make it more readable etc etc.

Have I not done the excitement-based development (yep I just invented that) I wouldn't have gone as far as I am now.

Learning code and opening a book without any hands on work is very overwhelming and you wouldn't understand why you're doing stuff!!

Taking something existing, breaking it apart and improving it is much more fun, and along the way you learn a bunch of stuff!

So don't think you need to understand all the complex stuff to get started, just grab an existing project and improve it step by step!

Anyone that is in a similar journey and would like to learn how to code, please feel free to reach out, happy to help!


r/learnjavascript • • Aug 02 '26

Wasted my first 3 years of Computer Engineering. Can I become internship-ready in 3 months and job-ready in 9 months?

55 Upvotes

Hi everyone,

I feel like I wasted the first 3 years of my Computer Engineering degree. My 4th year has just started, and I have only about 9 months left before graduation in 2027.

The only things I've learned properly are HTML and CSS. I haven't built any real projects yet. I spent most of my time focusing on getting good CGPA and SGPA instead of developing practical skills.

The biggest problem is that my college doesn't have good placements. Hardly any software companies visit our campus. Most of the companies that come are for sales, marketing, BPO, or call center roles.

I'm currently learning JavaScript, but I'm finding it quite difficult in the beginning.

My goal is to become internship-ready in the next 3 months and then spend the remaining time becoming job-ready before I graduate.

Can anyone guide me on what I should do?

Should I focus on Frontend Development?

Should I prepare for TCS Ninja/NQT instead?

What skills, projects, and roadmap should I follow to get an internship in 3 months?

After that, how should I prepare to land a software job before graduation?

I'm ready to work hard and learn every day. I just don't want to waste the remaining time.

Any advice or roadmap would really help. Thank you!


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?


r/learnjavascript • • Aug 25 '26

50 hours in... arrays and loops... holy...FUCK

52 Upvotes

HOW do i START understanding? I've understood everything pretty well up til now. Do i just keep going with the flow and kinda float through this section of the loops and arrays part? Do I keep throwing myself at the brick wall and looking at the solutions after half an hour of brainless staring? https://youtu.be/EerdGm-ehJQ?si=mTKUv0oail0AGDLM 8:43:00. It's just not clicking like the other parts of the tutorial.


r/learnjavascript • • Dec 20 '25

Are JavaScript arrays just objects?

50 Upvotes

Am I misunderstanding something, or is this basically how JavaScript arrays work? From what I can tell, JavaScript arrays are essentially just objects under the hood. The main difference is that they use [] as their literal syntax instead of {}, their keys look like numbers even though they’re actually strings internally, and they come with extra built-in behavior layered on top, like the length property and array-specific methods, which makes them behave more like lists than plain objects.


r/learnjavascript • • Apr 02 '26

How did you actually learn to code without getting overwhelmed?

48 Upvotes

I’ve been trying to improve my coding skills recently, but I keep running into the same problem:

There’s just so much to learn.

Tutorials, courses, YouTube videos, docs… it feels like I’m jumping between everything

For those of you who got past this stage:

- What actually worked for you?

- Did you follow a structured path or just build projects?

- Anything you wish you did earlier?

Would really appreciate real experiences 🙏


r/learnjavascript • • Oct 02 '26

JavaScript is so hard.

45 Upvotes

I recently started my fullstack development course this august and we have already gone thorugh html, css, git and now almost done with JavaScript as well. Html was easy, no problems there, but when it comes to css and more specifically grid and flex, thats when the headache started to appear. I've played some games involving both grid and flex but it won't stick in my head, don't know why. I am trying to do it myself in VS code but I always end up having to use ai to explain how to move forward and I know you're not supposed to use ai but it is a great tool to have, especially when you get stuck. And JavaScript... where do I even begin. I kinda understand it during the lectures but as soon as you're sitting by yourself my head gets totally blank.

I have been starting to use Scrimba and right now I'm rehearsing everything and whatching videos of everything, and the good thing with scrimba is that you get challenges during the videos.

For those of you who have been programming for a while, what study tips can you give? How did you guys go through the learning process?


r/learnjavascript • • Nov 24 '25

How much JavaScript is actually “enough”?

45 Upvotes

I’ve built around 16 Vanilla JS projects so far — quiz app, drag & drop board, expense tracker, todo app, recipe finder, GitHub finder, form validator, password generator, etc.

I’ve already covered:

  • DOM

  • Events

  • LocalStorage

  • APIs

  • async/await

  • CRUD

  • Basic app logic

Now I’m unsure:
Is this enough to move to React + backend, or should I keep doing more Vanilla JS?


r/learnjavascript • • Feb 24 '26

Understanding map() vs filter() in JavaScript — Am I thinking about this correctly?

42 Upvotes

I’ve been revising JavaScript array methods and wanted to check if my understanding is correct.

From what I understand, map() creates a new array of the same length as the original array. It runs a function on every element, and whatever value we return for each element gets stored in the new array. If we don’t return anything, the result for that position becomes undefined. So in simple terms, map() transforms every element.

On the other hand, filter() also creates a new array, but it only includes the elements that satisfy a condition. That means the resulting array can be smaller than the original one.

This is how I currently think about the difference between them. Am I understanding this correctly, or is there something important I’m missing? I’d really appreciate any corrections or deeper insights.


r/learnjavascript • • Sep 05 '26

3 engineers spent 40 minutes on my code and none of it was praise

40 Upvotes

My code worked. That was the only good thing anyone said about it. Nested conditionals 4 deep, no error handling, everything in one function. I have been writing javascript for a year and nobody had ever looked at it before. Self taught through Boot.dev and DataCamp, and nobody had read a line of my code before that call. How did you learn the part that is not making it run.


r/learnjavascript • • Jul 24 '26

What's one JavaScript feature you wish you had learned earlier?

40 Upvotes

I've been diving deeper into JavaScript recently, and every week I discover something that makes my code cleaner.

For me, learning about optional chaining (?.) and nullish coalescing (??) was a game changer.

What's one feature you wish you'd learned sooner?


r/learnjavascript • • Mar 19 '26

What's the use of classes in JS

40 Upvotes

I've recently started learning JS and I can't see a use for classes. I get how they work and how to use them but I can't see an actual real use for them.


r/learnjavascript • • Aug 29 '26

Beginner Here: Should I Start Over With The Odin Project?

39 Upvotes

Hey everyone,

I’ve completed HTML and around 50% of CSS from Hitesh Choudhary’s Full Stack Udemy course.

But now I’m thinking of switching to The Odin Project because, from what I’ve seen, it seems more focused on actually learning by building things rather than just following a course.

My plan is to start The Odin Project from the beginning and properly work through it, doing the exercises and projects myself instead of just watching/consuming content.

For people who have completed or are currently doing The Odin Project, or anyone who has experience with this kind of learning approach, feel free to share your thoughts, suggestions, or anything you think I should know:

  • I’m still a beginner, so is starting TOP from the beginning a good approach?

  • Are there any common mistakes beginners make while following it?

  • What should I focus on to actually retain what I learn?

  • Should I supplement TOP with anything else, or is it better to stick with it consistently?

  • Is there anything you wish you had known before starting?

I’d really appreciate any advice, criticism, or suggestions. If you think there’s a better approach than what I’m planning, feel free to share it.