r/learnjavascript

What YouTube channels actually helped you get JavaScript?

Been trying to pick up JavaScript properly for a while now, and honestly the amount of tutorials out there is overwhelming. I'll start a video, and halfway through realize the style just isn't clicking for me.

I'm hoping to find some recommendations from real people, not just search algorithms. Specifically, are there any channels or specific crash courses that stood out to you as being particularly clear for core concepts (closures, async, etc.) or good for project-based learning?

I've seen names like Traversy MediaWeb Dev Simplified, and The Net Ninja come up in old threads , but curious if there's anything newer or slightly under the radar that you'd swear by. Not looking for "best" objectively, just what worked for your brain.

Appreciate any direction! Just trying to spend less time searching and more time learning.

reddit.com
u/Rich-Confusion9944 — 3 hours ago
▲ 9 r/learnjavascript+5 crossposts

Playwright and Webstorm - E2E tests made easy to create and maintain

In this video, I show how I use Playwright together with WebStorm to create and maintain end-to-end tests. It is so easy to setup and use. Try it out!

youtu.be
u/Efficient-Public-551 — 7 hours ago
▲ 0 r/learnjavascript+1 crossposts

What is Polyfill in JS?

​

Today I got to know about polyfill by using this we can add and modify a function in javascript.

Like we can built custom map function

Array.prototype.myMap = function (callback){

const res = [];

for(let i=0;i<this.length;i++){

res.push(callback(this[i]))

}

return res;

}

const arr = [1,2,3,4]

const newArr=arr.myMap((ele)=>ele*2)

console.log(newArr)

reddit.com
u/Own_Grand1767 — 18 hours ago

Finding A Mentor

Hello,

I'm currently studying react js on the Odin project and I'm trying to find a mentor who could help me in my MERN journey. I know it sounds a lot despite not being able to pay but I would really appreciate a mentor who can help me develop my skills and help me in times when I ask stupid questions sometimes.

Time: India Time

Thanks!

reddit.com
u/Extra-Captain-6320 — 1 day ago

About block scoped vs function scoped

so from what I understand , when you want to declare variables, you can do that either using let or var, var is like the old method and it got replaced with let and we also use const.

var is function scoped while let is block scoped, and block scoped means that the variable known only inside of the block where you've declared it, inside of curly braces or squiggly brackets. I was watching a video explaining the differences between the three and they used an example using a for loop, and what they did was they used let obviously to declare the i inside of the loop, and when they tried to access it it gave them an error, the interesting part tho isn't that, it's the fact that even after they've deleted the curly braces it still was an error, so like a block then is everything inside of a pair of braces but the loops themselves and conditionals are considered blocks ?

reddit.com
u/Significant-Royal-86 — 2 days ago
▲ 12 r/learnjavascript+1 crossposts

The JS Event Loop isn't just a queue , here's the mental model most tutorials get wrong

Most explanations of the event loop teach you the mechanics but leave you with the wrong intuition. They show you a call stack and a task queue and say "JavaScript runs one thing at a time" , which is true but incomplete.

What they miss:

The microtask queue is not part of the event loop cycle in the way the task queue is. It drains completely after every task , including tasks queued by microtasks, before the loop moves on. This is why Promise chains never interleave with setTimeout callbacks.

The render step sits between tasks, not between microtasks. Queue enough microtasks and you'll block painting without blocking the call stack in any obvious way.

setTimeout(fn, 0) is a task queue entry. Promise.resolve().then(fn) is a microtask. These are fundamentally different lanes , not just different timings.

I wrote a deep dive on this with an interactive visualizer that animates every queue in real time as you run snippets. The framing is unconventional , I mapped it to Vedic karma and dharma as a mental model layer, but the mechanics are spec-accurate.

If you've ever been surprised by async execution order, this should close the gap permanently.

Interactive version: https://beyondcodekarma.in/javascript/js-event-loop/

u/svssdeva — 3 days ago

working on JS after a couple years, I'm a bit rusty, but why isn't appendChild not working properly?

context, basically what this should create is

  • one back to top button

  • one hamburger button that opens a div that contains a navigation menu

      //code that create both buttons here
      //some extract
      const navBtn = document.createElement('button');
      navBtn.className   = 'gallery-nav-btn';
      navBtn.textContent = '☰';
      navBtn.setAttribute('aria-label', 'Jump to section');
      /// other button
      const topBtn = document.createElement('button');
      topBtn.className   = 'gallery-nav-btn';
      topBtn.textContent = '↑';
      topBtn.setAttribute('aria-label', 'Back to top');
      topBtn.style.marginBottom = '8px';
      topBtn.addEventListener('click', () =&gt; {
        window.scrollTo({ top: 0, behavior: 'smooth' });
      });
      
      //Similar structure for the second button except it's a 'back to top button'
      //now to append
      navDiv.appendChild(topBtn);    // back to top button 
      navWrap.appendChild(popup);     // then the popup with the div nav menu
      navWrap.appendChild(navBtn);    // then the hamburger/nav button
      document.body.appendChild(navWrap);
    

what is rendered?

only the nav button and the popup, for some reason the back to top button doesn't render, it is there because I can inspect, and the appended button is there, it's not a CSS issue because I turned off all the CSS and they are not overlapping

it's really bugging me that I cannot figure out why the button doesn't show up, even if I comment out navWrap.appendChild(navBtn);the other button doesn't show up

reddit.com
u/Book-Parade — 1 day ago

How to Add an Orthophoto as a Custom Map Layer?

Good afternoon,
I have a georeferenced orthophoto of a specific area in my city, and I would like to overlay it on an interactive map.

The goal is to display the orthophoto in its correct spatial position, so that it integrates with the base map (such as Google Maps), showing my orthophoto only in that specific area while the rest of the map remains unchanged.

In other words, I want to use the orthophoto as a custom layer on top of the base map.

Could you guide me on the best way to implement this?

reddit.com
u/Aromatic_Survey6052 — 21 hours ago

Should I use const for everything and only switch to let when I hit an error?

I'm learning JS and I keep hearing "use const by default, only use let if you need to reassign." So I've been doing that. But sometimes I write a function, use const for an array or object, then later realize I need to reassign that variable entirely (not just mutate it). So I go back and change it to let. Is this the right workflow or am I missing something? I feel like I'm training myself to reach for const without thinking, then fixing it later. Should I just use let for everything until I'm more comfortable? Or is the friction good for learning when reassignment actually matters? I want to build good habits but I don't want to slow myself down overthinking variable declarations. Thanks.

reddit.com
u/carlosfelipe123 — 3 days ago

Weird array behaviour

I've got this project with an array that is doing weird things and causing an error further down the line. I'll paste a snippet below and the console output, but what I'd love is not so much the fix for my particular error, but to understand how an array could ever act like this.

Code

Console

In short, elements are acting as NaN when viewed in context of the wider array, but recognised as numbers when accessed individually - except the middle element of each array

u/Silent_Lion_OG — 3 days ago

I thought I had learned JavaScript but!

After learning some basic concepts of JavaScript, I went to a website called codewar to build logic but guess what happened, yes you thought right, I could not solve the first question itself. I want to take advice from my elders on how to improve my logic building and how I can become a problem solver?

reddit.com
u/happy_opopnomi — 4 days ago

Do you trust AI-generated tests, or do they cause more problems than they solve?

Genuine question. I've tried a few AI test generation tools and the pattern is always the same: it generates a full spec file, I spend time tweaking mocks and edge cases, then on the next run it regenerates everything and my changes are gone.

It made me think — the problem isn't AI writing bad tests. The problem is AI writing tests into files that humans also edit, with no concept of ownership.

Has anyone found a tool or workflow that handles this well? Or is the whole approach of AI-generated tests fundamentally at odds with how developers actually work?

reddit.com
u/Human-Philosopher782 — 3 days ago

rendering 10000+ items on a timeline without killing the browser - what works guys?

im building scheduling dashboard thing for a client and I need to show like 5000-8000 tasks on a timeline- gantt stuff - draggable bars, dependencies, different colors for resources, all that. I tried a few approaches

first was rendering everything as divs with absolute positioning- was big mistake. Browser just died around 2000 items. Scrolling was choppy as hell, dragging felt like moving through mud and i switched to canvas which was way faster but then I lost all the interactivity - no hover effects, no clicking on individual bars. Had to rebuild all that from scratch which took forever and Im still not sure I did it right.i looked at some libraries but Im not sure if I should go with something pre-built or keep hacking on my own solution.

So for those guys of you who built similar stuff - what worked? Are you using canvas with some kind of overlay for clicks? Or maybe SVG? I heard some people do HTML canvas for the background and SVG for the interactive bits but it sounds complicated.also how do you handle updates? when someone drags a task and you need to recalculate dependencies for thousands of items - do you do that on the client or send it to the backend? Im worried about performance

what made the biggest difference for you?dont want to rewrite this thing three times so any advice from someone who's been there would be awesome.thanks guys

reddit.com
u/bebo117722 — 4 days ago

anyone know a good P2P lib for node without a signaling server?

been looking for something lightweight that works over UDP without needing

a broker or signaling server. ended up building my own (js-setowire) but

not sure if i missed something obvious

curious what people are using

reddit.com
u/Setowire — 3 days ago

Tauri which you can build native apps for desktop &amp; phone with one code base

Hello dear developers, I have built all my apps using JavaScript, and for desktop i was always love to use electron.js.

but a while a go i've heard Tauri for the first time!

its features & powerful full-cross platforms performance adaptions are incredible!

so i have some questions if you gimme some times i'll be appreciated.

Q1/ is it better than electro.js for ERP & POS systems?

Q2/ it uses RUST for backend and for frontend uses webview, is it easy to use?

Q3/ i was looking for answer that instead RUST can use JS or TS, i found out that you can but you must use plugs - how easy or powerful is that?

Q4/ does it deserve to switch from electron?

Thanks for your answers appreciated a lot.

reddit.com
u/MuslimCoding — 3 days ago

Power shell Command line for beginners. "move"

1. Switch Partitions (Drives): Use the drive letter followed by a colon.

  • Syntax: [Drive_Letter]:
  • Example: C:\&gt; E:

2. Move to a folder in the current path:

  • Example: C:\Users\me&gt; cd myProjects
  • Result: C:\Users\me\myProjects&gt;

3. Move to a specific path (Absolute Path):

  • Example: C:\Users\me&gt; cd E:\Programs
  • Result: E:\Programs&gt; (Note: In CMD, you might need cd /d E:\Programs to switch drives and folders at once).

4. Go back to the parent folder:

  • Syntax: cd .. (Make sure to add a space after cd).
  • Example: C:\Users\me\myProjects&gt; cd ..
  • Result: C:\Users\me&gt;

5. Navigate back and forth using the Stack (pushd & popd):

  • Example:
    • C:\Users\me&gt; pushd E:\Programs (Saves current path and moves to E:\Programs)
    • E:\Programs&gt; popd (Returns you exactly where you were)

6. Pro Tip for PowerShell 7 users:

  • Use cd - to go back to the previous path (like Linux).
  • Use cd ~ to go directly to your Home directory.

7. Move to the Drive Root: To jump directly to the root of the current drive (e.g., C:\ or E:\):

  • Command: cd \
  • Example: C:\Users\me\Documents\Projects&gt; cd \
  • Result: C:\&gt;
reddit.com
u/Moh_Gh_DZ — 3 days ago

Today I learned about the amazing "replace" string method

I wanted to show you a cool new method for strings I have found randomly! I found it ony a JavaScript cheat sheet website and then I found more information about it on the Mozilla developer wiki.

The replace method does exactly as you'd think—it finds a word in the string, swaps it with a new word and returns a new updated string. Usually I'd simply split the string, I'd find the string I need, modify it and then join together, but replace makes it easier. If you need a simple string modification, you can use this method instead!

What I love about this method is that if the string is occupied with other characters that you don't want changed (like "." or " ' " symbols), the method only takes the matching characters you want to replace and leaves the rest. To show an example of what I mean:

const sentence = "This is Brandon's sentence.";
const newName = sentence.replace("Brandon", "Jason");
const newEnd = newName.replace("sentence", "thought");

console.log(newEnd);
// The variable logs "This is Jason's thought."

As a quick note, this method only replaces the first string of characters it matches. If you wish to replace all similar words in a string, you'll have to use the replaceAll method:

const sentence = "This word really is a word that is a word to live by."
const replaceWord = sentence.replaceAll("word", "sentence");

console.log(replaceWord);
// The variable logs "This sentence really is a sentence that is a sentence to live by."

There are other cases on how to use the replace method, but I am not experienced enough to tell you about those. Anyways, I just thought that this was a cool find!

reddit.com
u/4Roman4 — 5 days ago

Stuck.

I am having some insecurities about coding and I can't seem to code anything. It's like i'm paralyzed from trying i'm scared of bumping into a bug and not knowing what to do and it's becoming more and more debilitating. It's gotten to the point where I could read a 1000 page book instead of simply opening my ide and writing code.

For context I've been coding for about 8 months but really it's only been like 2 months of actual dedicated coding. The rest has been plagued with a choking anxiety and I'm tired of it coming and going.

If I could get any help or any resources that could be helpful that would be great.

reddit.com
u/Low_Leadership_4841 — 5 days ago