React Native Interview Handbook — Part 8 of 10: Code Output Challenges
This is Part 8 of 10 , a bonus practice article with 70 code-output challenges . Each challenge asks you to predict the result before revealing the answer and reasoning. Complete series This Dev.to series has five core handbook articles plus five focused practice extras. Open the series page to move through the complete reading order: Part 1: JavaScript — core handbook, questions 1–120 Part 2: React — core handbook, questions 121–220 Part 3: React Native — core handbook, questions 221–420 Part 4: Performance & Architecture — core handbook, questions 421–560 Part 5: Senior & System Design — core handbook, questions 561–719 Part 6: Output-Based JavaScript Practice — bonus practice article Part 7: Coding Interview Practice — bonus practice article Part 8: Code Output Challenges — bonus practice article Part 9: Current React Native Interview Questions — new high-frequency practice article Part 10: Project & Production Interviews — senior project ownership and real-production practice How to use this challenge set Read the code, state the exact output or error, then explain the language rule. Do not run the snippet until you have committed to an answer. For React Native interviews, connect the JavaScript behavior to rendering, state updates, list handling, or the JavaScript thread when relevant. Skills tested Hoisting, scope, closures, and this Arrays, conditions, references, object behavior, and loose versus strict equality Promises, timers, async / await , and microtasks Common JavaScript patterns used in React and React Native interviews Code output challenges Challenge 1. Block-scoped counter Predict the exact output before opening the answer. let total = 0 ; for ( let i = 0 ; i < 3 ; i ++ ) { total += i ; } console . log ( total ); Answer and explanation Expected output: 3 Why: The loop adds 0, 1, and 2. Challenge 2. var callback loop Predict the exact output before opening the answer. for ( var i = 0 ; i < 3 ; i ++ ) { setTimeout (() => { console . log ( i ); }, 0