FlareStart
HomeNewsHow ToSources
FlareStart

Where developers start their day. All the tech news & tutorials that matter, in one place.

Quick Links

  • Home
  • News
  • Tutorials
  • Sources

Connect

© 2026 FlareStart. All rights reserved.

Back to articles
Question of the Day #17 [Talk::Overflow]
How-ToWeb Development

Question of the Day #17 [Talk::Overflow]

via Dev.to JavaScriptValPetal Tech Labs1d ago

This post explains a quiz originally shared as a LinkedIn poll . 🔹 The Question let count = 0 ; function increment () { count ++ ; var count ; return count ; } console . log ( increment ()); console . log ( count ); Hint: Think about where var declarations end up before any code runs — and what happens when you increment something that doesn't have a value yet. Follow me for JavaScript puzzles and weekly curations of developer talks & insights at Talk::Overflow: https://talkoverflow.substack.com/ 🔹 Solution Correct answer: B) NaN, 0 The first console.log prints NaN . The second prints 0 . 🧠 How this works This quiz targets a subtle but dangerous interaction between var hoisting and variable shadowing. When JavaScript parses the increment function, the var count; declaration is hoisted to the top of the function scope — even though it appears after count++ in the source code. This creates a local count variable inside increment , completely separate from the outer let count = 0 . At run

Continue reading on Dev.to JavaScript

Opens in a new tab

Read Full Article
2 views

Related Articles

Sony Promo Codes and Discounts: 45% Off
How-To

Sony Promo Codes and Discounts: 45% Off

Wired • 16h ago

I Wanted Extra Income — 7 Things I Learned the Hard Way
How-To

I Wanted Extra Income — 7 Things I Learned the Hard Way

Medium Programming • 17h ago

How to clear your Google Search cache on Android (and why it's a must for me)
How-To

How to clear your Google Search cache on Android (and why it's a must for me)

ZDNet • 20h ago

15+ best Alexa commands to make your home work smarter (Prime not required)
How-To

15+ best Alexa commands to make your home work smarter (Prime not required)

ZDNet • 21h ago

Remove Duplicates from Sorted Array
How-To

Remove Duplicates from Sorted Array

Medium Programming • 21h ago

Discover More Articles