💻 JavaScript Interview Question What will be the output of the following code? for (var i = 1; i <= 3; i++) { setTimeout(function() { console.log(i); }, 1000); } 🤔 Think before you answer! Options: A) 1 2 3 B) 3 3 3 C) 4 4 4 D) Error 💡 Bonus Question: How would you modify the code so it prints 1 2 3 instead? 👇 Comment your answer. If you are preparing for JavaScript or frontend interviews, I regularly share interview questions and also conduct mock interview sessions through devCareer mentor to help candidates gain confidence. #JavaScript #FrontendInterview #CodingInterview #CareerGrowth #MockInterview
JavaScript Interview Question: Output of setTimeout Loop
More Relevant Posts
-
3 months habve gone by. If interview prep is still "something you’ll start soon", it probably won’t happen without a plan. Not more effort. Just better structure. Learn, Practice, Apply and Perform. That’s the framework we built our 1-month plan around at GreatFrontEnd. Follow the full plan: https://lnkd.in/gGST2UGw #frontendinterviews #webdevelopment #frontenddevelopment #greatfrontend #javascript
To view or add a comment, sign in
-
-
Starting a 30 Days JavaScript Logic Series for Frontend Interviews. As a frontend developer, problem-solving with JavaScript is essential for technical interviews. So for the next 30 days, I’ll solve one JavaScript logic problem daily and share: • Problem statement • Approach • JavaScript solution Topics I'll cover include: String problems Array manipulation Number logic JavaScript polyfills Interview-level coding questions Goal: improve problem-solving and prepare for frontend developer interviews. #javascript #frontend #codingchallenge #webdevelopment
To view or add a comment, sign in
-
🚀 10 JavaScript Interview Questions Every Developer Should Know While preparing for frontend interviews, I noticed one thing: Most companies don’t ask very advanced JavaScript. They ask simple-looking questions that test how well you understand the basics. Here are some of the most common JavaScript interview questions: 1️⃣ What is the difference between var, let, and const? 2️⃣ What is the difference between == and === ? 3️⃣ What is a closure in JavaScript? 4️⃣ What is hoisting? 5️⃣ What is the difference between null and undefined? 6️⃣ What is the difference between synchronous and asynchronous code? 7️⃣ What is the event loop in JavaScript? 8️⃣ What is the difference between map(), filter(), and reduce()? 9️⃣ What is the difference between function declaration and arrow function? 🔟 What is the difference between call(), apply(), and bind()? The interesting thing is: These questions look simple. But in interviews, companies usually ask deeper follow-up questions after them. Because they want to know: > Do you only know the answer… > Or do you really understand JavaScript? 💬 Which JavaScript question do you find the most difficult? #JavaScript #webdevelopment #frontend #developers #interviewquestions #coding #learning
To view or add a comment, sign in
-
🔥 5 JavaScript concepts I revised today: • Closures • Promises • Async/Await • Array methods • DOM manipulation If you’re preparing for interviews — master these. Which one confuses you the most? 👇
To view or add a comment, sign in
-
🚀 Just created my own handwritten Frontend Interview Notes! I’ve been revising core JavaScript concepts and decided to put everything together in a simple handwritten style to make learning more clear and visual. This includes: ✔️ Primitive vs Non-Primitive data types ✔️ Functions & Scope (global, block, lexical) ✔️ Callback functions ✔️ Important array methods (map, filter, reduce, every) ✔️ call(), apply(), bind() ✔️ Anonymous functions & NaN The goal was to keep things easy to understand, quick to revise, and more practical for interviews. Sometimes, writing concepts in your own way makes a big difference in understanding them deeply. If you're preparing for frontend interviews, this might help you revise faster! #JavaScript #FrontendDevelopment #WebDevelopment #InterviewPreparation #CodingJourney #Learning
To view or add a comment, sign in
-
JavaScript Interview Questions From Basics to Advanced (Complete Guide) Prepare for your next developer interview with this complete collection of JavaScript interview questions starting from core fundamentals to advanced concepts. Cover topics like variables, scope, closures, hoisting, promises, async/await, event loop, prototypes, ES6+, and performance optimization. Whether you're a beginner or an experienced developer, this guide helps you strengthen concepts, improve problem-solving skills, and confidently crack technical interviews. #JavaScript #JSInterview #FrontendDeveloper #WebDevelopment #CodingInterview #LearnJavaScript #Programming #DeveloperLife #TechInterview #SoftwareEngineering
To view or add a comment, sign in
-
** Technical Interview Question ** Today I worked on a common but important interview question: 🔍 Find the first non-repeating element in an array 👉 Example: [4, 5, 1, 2, 0, 4] 👉 Output: 5 💡 My Approach: 1. First, I counted how many times each element appears 2. Then, I traversed the original array to find the first element that appears only once ⚡ Key Insights: Order matters — that’s why iterating over the original array is important Using a frequency map makes the solution efficient Time Complexity: O(n) Space Complexity: O(n) 🎯 Practicing these types of problems really helps in improving logic building and interview confidence, especially for Frontend / MERN Stack roles. Consistency is the key 🔥 #JavaScript #CodingInterview #ProblemSolving #MERNStack #FrontendDeveloper #ReactJS
To view or add a comment, sign in
-
-
🚀 Interview Question That Tests Your JavaScript Fundamentals Here’s a simple-looking question that often confuses even experienced developers: console.log([] == ![]); 👉 What will be the output? Most people expect false, but the answer is actually true 😲 💡 Let’s break it down: ![] → false (Because an empty array is truthy, so NOT makes it false) Now the expression becomes: [] == false During comparison: [] → converted to "" (empty string) false → converted to 0 Now: "" == 0 → true 🔥 Key Takeaway: JavaScript’s loose equality (==) does type coercion, which can lead to unexpected results. 💬 Have you faced similar tricky questions in interviews? Drop them below 👇 #react #javascript #interview #prep #prepration
To view or add a comment, sign in
-
💻 JavaScript Programs You MUST Know for Interviews 🚀 If you're preparing for coding interviews, these basic JS programs can make a big difference 👇 📌 From the carousel (pages 2–6): ✔️ Reverse a String ✔️ Capitalize First Letter ✔️ Remove Duplicates from Array ✔️ Create 2D Array ✔️ Replace String Values using built-in methods 💡 These aren’t just simple programs — they test: 👉 Logic building 👉 Problem-solving skills 👉 Understanding of JS fundamentals 🔥 Example: Reversing a string using a loop helps you understand indexing & iteration deeply. 🎯 Why this matters? Because interviewers don’t just check answers… They check how you think. 💬 Practice these daily & try writing them without looking at code! 📌 Save this post for quick revision before interviews. #JavaScript #CodingInterview #DSA #WebDevelopment #Programming #Frontend #Developers #CodingPractice
To view or add a comment, sign in
-
One thing that confused me a lot when I started with React - Why does useEffect behave differently each time? 🤔 It all makes sense once you map it to class lifecycle methods. Whether you're learning React or prepping for interviews - this one's for you 👇 🔖 Save this for later. Follow for more. #React #ReactHooks #useEffect #FrontendDevelopment #JavaScript #WebDevelopment #ReactInterview #SoftwareEngineering
To view or add a comment, sign in
Explore related topics
- Mock Interviews for Coding Tests
- Questions to Ask Interviewers
- Tips for Coding Interview Preparation
- Interview Answers That Make You Stand Out
- Backend Developer Interview Questions for IT Companies
- Best Interview Answers for Job Seekers
- Interview Questions for Fast-Paced Workplaces
- How to Answer the "Why You?" Interview Question
- Common Questions in Recruiter Interviews
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