💻 JS Global Scope: Browser vs Node.js Browser: window is global Node.js: each file is a module; use global for true globals Simple, but knowing this avoids bugs when switching between frontend & backend! 🚀 #JavaScript #NodeJS #WebDev #CodingTips
Browser vs Node.js Global Scope
More Relevant Posts
-
While working on a full-stack project with Next.js, I sometimes needed to quickly check environment variables without modifying the code. Here’s a simple way to do it directly from the terminal (required 'dotenv' library): Check env value: node -e "require('dotenv').config(); console.log(process.env.DATABASE_URL)" It’s a small tip, but quite useful when you want to check env value. I’ll probably share a few more small things like this from my project along the way. #nextjs #nodejs #dotenv #webdevelopment #softwareengineering #buildinpublic #javascript #devtips #webdevUK
To view or add a comment, sign in
-
Day 65/100 – Starting with Node.js 🚀 Learned: What Node.js is and how it allows JavaScript to run outside the browser Basic idea of the Event Loop and how Node handles multiple requests efficiently Introduction to Express and how it simplifies backend development What stood out: Node.js doesn’t work like traditional synchronous systems. Instead of waiting, it handles tasks asynchronously using the event loop, making it fast and scalable. #NodeJS #BackendDevelopment #JavaScript #LearningInPublic #100DaysOfCode
To view or add a comment, sign in
-
-
Build a Headless Expense Tracker to practice Typescript. I write pure Typescript functions to handle all the math and logic, and then connected it to a very simple Vanilla JS frontend. A few key things I learned and implemented during this build: - I stopped using long, messy chains of .filter() and learned how to use a single Array.reduce() to group and calculate my expenses cleanly. - I learned how to handle TypeScript's strict null-checking without making the app crash when building dynamic objects. Repo (mono): https://lnkd.in/d_2bTvvy #TypeScript #WebDev #LearningInPublic #JavaScript
To view or add a comment, sign in
-
Day 82 / 365 👨💻 Started understanding React state. 🧠 Problem that useState solves ⚙️ How useState works step by step 🔄 Why re-rendering happens ⏳ Why state updates aren’t immediate 🔁 Updater function vs direct value #365DaysOfCode #React #JavaScript #Frontend
To view or add a comment, sign in
-
🚀 Today I learned something really interesting about the Node.js Event Loop. I always assumed the event loop behaves the same everywhere, but it actually works differently in the Browser vs the Node.js environment. In Node.js, the event loop goes through multiple phases such as: • Timers (Expired Callbacks) • I/O Polling • setImmediate • Close Callbacks Understanding these phases really helped me see how asynchronous operations are scheduled and executed under the hood. It also made me realize how important it is to understand core fundamentals, not just frameworks. The deeper you go into JavaScript, the more fascinating it gets. ⚡ Thanks Piyush Garg and Hitesh Choudhary for such a great explanation. #NodeJS #JavaScript #BackendDevelopment #LearningInPublic #EventLoop
To view or add a comment, sign in
-
-
I just deleted 30 lines of code from a React component. no refactor. no library. just one hook in React 19. it's called use() — and it changes how you handle async data and context in your components. most devs haven't heard of it yet. swipe through ↓ broke it down simply what's the most boilerplate you've deleted in a single React upgrade? 👇 #react #react19 #javascript #webdev #frontend
To view or add a comment, sign in
-
🚀 Day 2 of Building React Projects Today I built a Counter Application using React.js. This project helped me understand the useState Hook, which is used to manage state in functional components. ✨ Features: • Increase counter value • Decrease counter value • Reset counter 🛠 Tech Stack: React.js JavaScript HTML CSS 💻 Source Code: https://lnkd.in/dnEyi_ag Building small projects like this helps strengthen React fundamentals. #ReactJS #JavaScript #FrontendDevelopment #WebDevelopment
To view or add a comment, sign in
-
Most React developers use this pattern every day: setCount(prev => prev + 1) But very few can clearly explain why it’s necessary. In React, state updates are not immediate. They can be batched and executed later, which means the value you’re using (count) might already be outdated when the update actually runs. The functional update avoids this problem. Instead of relying on a potentially stale value, it receives the latest state at the exact moment React processes the update. So instead of saying: “set the value to this” you’re saying: “update based on whatever the current value is” That’s the key difference. This pattern isn’t just syntax, it’s how you avoid subtle bugs when your next state depends on the previous one. #React #JavaScript #Frontend #WebDevelopment #SoftwareEngineering
To view or add a comment, sign in
-
Ever wondered how Node.js works behind the scenes? 🤔 In my latest blog, I broke down Node.js internals in a simple way — focusing on the 3 core components: 🔹 V8 Engine (executes JS & manages memory) 🔹 Libuv (handles async tasks & event loop) 🔹 Bindings (connects V8 with system-level operations) Understanding this flow really changes how you look at things like fs.readFile() or setTimeout() 💡 👉 Read the full blog here: https://lnkd.in/g-AbBCiy I’d really appreciate your thoughts, feedback, or any experiences you’ve had while working with event propagation 😊 Hitesh Choudhary | Piyush Garg | Akash Kadlag #JavaScript #WebDevelopment #Blog #NodeJs #Cohort2026 #LearnInPublic #libuv #v8
To view or add a comment, sign in
-
✨ Master JavaScript Array Destructuring for Cleaner Code Modern JavaScript lets you extract values in one line—making your code shorter, clearer, and easier to maintain. 🧠 Why it matters: Readable code = fewer bugs + faster development. ⚛️ If you’re using React, you’re already using destructuring (useState, useReducer). #JavaScript #FrontendDevelopment #WebDevelopment #ReactJS #CleanCode #ModernJS #SoftwareEngineering
To view or add a comment, sign in
-
Explore content categories
- Career
- Productivity
- Finance
- Soft Skills & Emotional Intelligence
- Project Management
- Education
- Technology
- Leadership
- Ecommerce
- User Experience
- Recruitment & HR
- Customer Experience
- Real Estate
- Marketing
- Sales
- Retail & Merchandising
- Science
- Supply Chain Management
- Future Of Work
- Consulting
- Writing
- Economics
- Artificial Intelligence
- Employee Experience
- Workplace Trends
- Fundraising
- Networking
- Corporate Social Responsibility
- Negotiation
- Communication
- Engineering
- Hospitality & Tourism
- Business Strategy
- Change Management
- Organizational Culture
- Design
- Innovation
- Event Planning
- Training & Development