[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"detail-sidebar-cat-0-en-105":3,"doc-seo-721618-105":59,"doc-detail-721618-en":130,"doc-similar-721618":279},{"code":4,"msg":5,"data":6},0,"success",[7,13,18,23,28,33,38,43,48,51,55],{"id":8,"doc_module":4,"doc_module_name":9,"category_name":10,"show_sort_weight":11,"slug":12},1,"Document","Story & Novel",90,"story-novel",{"id":14,"doc_module":4,"doc_module_name":9,"category_name":15,"show_sort_weight":16,"slug":17},2,"Literature",80,"literature",{"id":19,"doc_module":4,"doc_module_name":9,"category_name":20,"show_sort_weight":21,"slug":22},4,"Exam",70,"exam",{"id":24,"doc_module":4,"doc_module_name":9,"category_name":25,"show_sort_weight":26,"slug":27},5,"Comic",60,"comic",{"id":29,"doc_module":4,"doc_module_name":9,"category_name":30,"show_sort_weight":31,"slug":32},6,"Technology",50,"technology",{"id":34,"doc_module":4,"doc_module_name":9,"category_name":35,"show_sort_weight":36,"slug":37},7,"Healthcare",40,"healthcare",{"id":39,"doc_module":4,"doc_module_name":9,"category_name":40,"show_sort_weight":41,"slug":42},8,"Research & Report",30,"research-report",{"id":44,"doc_module":4,"doc_module_name":9,"category_name":45,"show_sort_weight":46,"slug":47},9,"Religion & Spirituality",20,"religion-spirituality",{"id":46,"doc_module":4,"doc_module_name":9,"category_name":49,"show_sort_weight":46,"slug":50},"World Cup","world-cup",{"id":52,"doc_module":4,"doc_module_name":9,"category_name":53,"show_sort_weight":52,"slug":54},10,"Lifestyle","lifestyle",{"id":56,"doc_module":4,"doc_module_name":9,"category_name":57,"show_sort_weight":24,"slug":58},19,"General","general",{"code":4,"msg":60,"data":61},"ok",{"site_id":62,"language":63,"slug":64,"title":65,"keywords":66,"description":67,"schema_data":68,"social_meta":123,"head_meta":125,"extra_data":127,"updated_unix":129},105,"en","advanced-javascript-visualized-execution-context-thread-callstack-introduction","Advanced JavaScript Visualized - Execution Context, Thread & Callstack - Introduction","","Advanced JavaScript Visualized explains fundamental runtime concepts that govern how JavaScript code executes. The chapter introduces key terminology—memory, processes, threads, execution context, scope, callstack—and connects these ideas with practical execution flow. It describes how memory holds information, how processes and threads relate to running code, how scope restricts variable accessibility, and how the callstack applies a Last In First Out order. It then previews execution management and why JavaScript is single-threaded and synchronous.",{"@graph":69,"@context":122},[70,84,105],{"@type":71,"itemListElement":72},"BreadcrumbList",[73,77,79,82],{"item":74,"name":75,"@type":76,"position":8},"https://docshare.wps.com","Home","ListItem",{"item":78,"name":9,"@type":76,"position":14},"https://docshare.wps.com/document/",{"item":80,"name":30,"@type":76,"position":81},"https://docshare.wps.com/document/technology/",3,{"item":83,"name":65,"@type":76,"position":19},"https://docshare.wps.com/document/advanced-javascript-visualized-execution-context-thread-callstack-introduction/721618/",{"url":83,"name":65,"@type":85,"image":86,"author":91,"headline":65,"publisher":94,"fileFormat":97,"inLanguage":63,"description":67,"dateModified":98,"datePublished":99,"encodingFormat":97,"isAccessibleForFree":100,"interactionStatistic":101},"DigitalDocument",{"url":87,"@type":88,"width":89,"height":90},"https://docshare.wps.com/thumbnails/advanced-javascript-visualized-execution-context-thread-callstack-introduction/721618.png","ImageObject",300,407,{"name":92,"@type":93},"Obex","Person",{"url":74,"name":95,"@type":96},"DocShare","Organization","application/pdf","2026-11-23","2026-11-19",true,{"@type":102,"interactionType":103,"userInteractionCount":14},"InteractionCounter",{"@type":104},"ViewAction",{"@type":106,"mainEntity":107},"FAQPage",[108,114,118],{"name":109,"@type":110,"acceptedAnswer":111},"What is an execution context in JavaScript, according to the chapter?","Question",{"text":112,"@type":113},"An execution context is currently running code inside memory, including both function execution and regular JavaScript expressions like if-else and loops.","Answer",{"name":115,"@type":110,"acceptedAnswer":116},"How do memory, processes, and threads relate to each other?",{"text":117,"@type":113},"Memory holds information for computation; a process is a currently running program (a bundled set of instructions); threads are the smaller running instructions or execution paths needed to complete parts of that process.",{"name":119,"@type":110,"acceptedAnswer":120},"What does the callstack do and why is it Last In First Out?",{"text":121,"@type":113},"The callstack is a container for adding and removing code blocks/functions so the most recently added item runs first, following a Last In First Out pattern.","https://schema.org",{"og:url":83,"og:type":124,"og:title":65,"og:site_name":95,"og:description":67},"article",{"robots":126,"canonical":83},"index,follow",{"doc_id":128,"site_id":62},721618,1795060953,{"code":4,"msg":5,"data":131},{"doc_id":128,"user_id":132,"nickname":92,"user_avatar":133,"doc_module":4,"category_id":29,"category_name":30,"doc_title":65,"doc_description":67,"doc_content":134,"file_id":135,"file_url":136,"file_type":137,"file_size":138,"view_count":14,"is_deleted":4,"is_public":8,"is_downloadable":8,"audit_status":8,"page_count":139,"language":140,"language_code":63,"site_id":62,"html_lang":63,"table_of_contents":141,"faqs":142,"seo_title":143,"seo_description":67,"update_tm":129,"read_time":144,"preview_page_count":145,"preview_urls":146},5909898192665,"https://ap-avatar.wpscdn.com/davatar_29158cc5080c5b710cf443261637dec0","Meet Patel  \nAdvanced JavaScript Visualized  \nCopyright © 2021 by Meet Patel  \nAll rights reserved. No part of this publication may be reproduced, stored or transmitted in any form or by any means, electronic, mechanical, photocopying, recording, scanning, or otherwise without written permission from the publisher. It is illegal to copy this book, post it to a website, or distribute it by any other means without permission.  \nMeet Patel asserts the moral right to be identified as the author of this work.  \nMeet Patel has no responsibility for the persistence or accuracy of URLs for external or third-party Internet Websites referred to in this publication and does not guarantee that any content on such Websites is, or will remain,  \naccurate or appropriate.  \nDesignations used by companies to distinguish their products are often claimed as trademarks. All brand names and product names used in this book and on its cover are trade names, service marks, trademarks and registered trademarks oftheir respective owners. The publishers and the book are not associated with any product or vendor mentioned in this book. None of the companies referenced within the book have endorsed the book.  \nFirst edition  \nThis book was professionally typeset on Reedsy Find out more at [reedsy.com](reedsy.com)  \nI like to dedicate this book to my engineering which made me realize I should have started writing earlier :)  \nThe true sign of intelligence is not knowledge but imagination.  \n-Albert Einstein  \nContents  \n1. Execution Context, Thread & Callstack  \n2. Closure-A Deep Dive  \n3. Prototype , __proto__ & Objects  \n4. Asynchronous Execution  \n5. Iterators, Generators, and Async-Await  \n6. NodeJS, C++, Queues & Servers  \n7. Bonus  \n1  \nExecution Context, Thread &  \nCallstack  \nWe all know that we always had and have a love and hate relationship with JavaScript from the day you or I started learning it . But , sometimes philosophy around those weird JavaScript concepts can easily be understood if we just dig down the basics and fundamentals .  \nThis is the most important and fundamental chapter of all. So if you get this, then almost everything will be easy to follow and understand. Welcome to the exciting journey of JavaScript beyond normal expectations.  \nTerminologies  \n Memory  \n Processes and Threads  \n Execution Context  \n Scope  \n The Thread of Execution  \n Callstack  \nMemory : - A computer is just a machine that takes a set of instructions and executesit , but during that time computer needs to hold some information for the calculation or for any other task . So , we have storage devices like RAM and ROM (HDDs , SSDs) which hold information temporarily or permanently . So , memory is just a part where our information is held .  \nProcess : - A currently executing/ running program (bundled up instructions) is called process . Each process is just a blueprint for what the computer needs to do in order to finish a given task .  \nThread : - A process is a set of instructions bundled up , but each instruction might need to be executed as well to achieve the original process to be finished and so the thread is just a simple lightweight running process (a small set of instruction/s in execution) .  \nExecution Context : - It 's nothing but a currently running code inside memory(every running program needs memory) which could be normal function execution or normal JavaScript code like if-else , loop , or any other expression .  \nMemory + Process == Execution Context  \nScope : - A Scope is an allocated memory to a specific or currently executing function or block of code . That is to say , variables(memory) is not available outside of it to functions or block of code .  \nScope == Memory Restriction/s for execution context/s  \nThe Thread of Execution : - A currently running(executing) function or block of code is a thread of execution . That is to say , it is a small running process inside our main process .  \nCallstack : - It 's a container in which you","cbCaifQ5BcLqGyVo","https://ap.wps.com/l/cbCaifQ5BcLqGyVo","pdf",47488531,282,"English","# Execution Context, Thread & Callstack\n## Terminologies\n## Memory\n## Processes and Threads\n## Execution Context\n## Scope\n## The Thread of Execution\n## Callstack\n## High-level process overview\n## Example 1.1","[{\"question\":\"What is an execution context in JavaScript, according to the chapter?\",\"answer\":\"An execution context is currently running code inside memory, including both function execution and regular JavaScript expressions like if-else and loops.\"},{\"question\":\"How do memory, processes, and threads relate to each other?\",\"answer\":\"Memory holds information for computation; a process is a currently running program (a bundled set of instructions); threads are the smaller running instructions or execution paths needed to complete parts of that process.\"},{\"question\":\"What does the callstack do and why is it Last In First Out?\",\"answer\":\"The callstack is a container for adding and removing code blocks/functions so the most recently added item runs first, following a Last In First Out pattern.\"}]","Advanced JavaScript Visualized - Execution Context, Thread & Callstack - Introduction | PDF",711,29,[147,151,155,159,163,167,171,175,179,183,187,192,197,202,207,212,217,222,227,231,235,240,245,250,255,260,265,270,275],{"page_no":8,"url":148,"width":149,"height":150},"https://res-academy.cache.wpscdn.com/upload/kdocshare/2026-11-19/efe915d81ffe6ca6696fea979d2de3b6.webp",983,1272,{"page_no":14,"url":152,"width":153,"height":154},"https://res-academy.cache.wpscdn.com/upload/kdocshare/2026-11-19/61c6d71752aaabcbf18ee0f4d792532e.webp",982,1270,{"page_no":81,"url":156,"width":157,"height":158},"https://res-academy.cache.wpscdn.com/upload/kdocshare/2026-11-19/47df6a4e32fa78a112d4346e4e835fd6.webp",981,1269,{"page_no":19,"url":160,"width":161,"height":162},"https://res-academy.cache.wpscdn.com/upload/kdocshare/2026-11-19/bde5e6efeb2c7d0e9d3f646c48e9868b.webp",980,1268,{"page_no":24,"url":164,"width":165,"height":166},"https://res-academy.cache.wpscdn.com/upload/kdocshare/2026-11-19/4790ac988afcd78db1ee9bc5545bf4f8.webp",979,1267,{"page_no":29,"url":168,"width":169,"height":170},"https://res-academy.cache.wpscdn.com/upload/kdocshare/2026-11-19/a6c62371184c68f0c9d36071f5073e35.webp",978,1265,{"page_no":34,"url":172,"width":173,"height":174},"https://res-academy.cache.wpscdn.com/upload/kdocshare/2026-11-19/c3d0ab5177951d29b3c6214f0c58eff0.webp",977,1264,{"page_no":39,"url":176,"width":177,"height":178},"https://res-academy.cache.wpscdn.com/upload/kdocshare/2026-11-19/75d5d1a028a440ed1295780c2fb2f44e.webp",976,1263,{"page_no":44,"url":180,"width":181,"height":182},"https://res-academy.cache.wpscdn.com/upload/kdocshare/2026-11-19/9e35c91167009d655fefa7944054b54b.webp",975,1261,{"page_no":52,"url":184,"width":185,"height":186},"https://res-academy.cache.wpscdn.com/upload/kdocshare/2026-11-19/051a33ec94b7590795fdb921717df3b0.webp",974,1260,{"page_no":188,"url":189,"width":190,"height":191},11,"https://res-academy.cache.wpscdn.com/upload/kdocshare/2026-11-19/09a40b9b1d3e1405fd86605489aa45b3.webp",973,1259,{"page_no":193,"url":194,"width":195,"height":196},12,"https://res-academy.cache.wpscdn.com/upload/kdocshare/2026-11-19/81f071a65b4e75c650a6b5a1f0ca8d4e.webp",972,1257,{"page_no":198,"url":199,"width":200,"height":201},13,"https://res-academy.cache.wpscdn.com/upload/kdocshare/2026-11-19/1acca6b9e2e56663d8c131c9039a084d.webp",971,1256,{"page_no":203,"url":204,"width":205,"height":206},14,"https://res-academy.cache.wpscdn.com/upload/kdocshare/2026-11-19/63452f49989b2cc453e857ccf82b8099.webp",970,1255,{"page_no":208,"url":209,"width":210,"height":211},15,"https://res-academy.cache.wpscdn.com/upload/kdocshare/2026-11-19/2056f48768e9011c6d82fb26bb6981fd.webp",969,1254,{"page_no":213,"url":214,"width":215,"height":216},16,"https://res-academy.cache.wpscdn.com/upload/kdocshare/2026-11-19/9f18c09448d71c7e5b5bff437f2caa36.webp",968,1252,{"page_no":218,"url":219,"width":220,"height":221},17,"https://res-academy.cache.wpscdn.com/upload/kdocshare/2026-11-19/3b10d197e2a2a8c84adf92f26c651d27.webp",967,1251,{"page_no":223,"url":224,"width":225,"height":226},18,"https://res-academy.cache.wpscdn.com/upload/kdocshare/2026-11-19/452de54bd4ae7ce83556e6f8bc3e744a.webp",966,1250,{"page_no":56,"url":228,"width":229,"height":230},"https://res-academy.cache.wpscdn.com/upload/kdocshare/2026-11-19/8d611f46b8754f0af40b1fc029540e27.webp",965,1248,{"page_no":46,"url":232,"width":233,"height":234},"https://res-academy.cache.wpscdn.com/upload/kdocshare/2026-11-19/16e90b64864a9f539fa34c95b4b959af.webp",964,1247,{"page_no":236,"url":237,"width":238,"height":239},21,"https://res-academy.cache.wpscdn.com/upload/kdocshare/2026-11-19/5a07bcda4176acca8cbc815846b4fd3b.webp",963,1246,{"page_no":241,"url":242,"width":243,"height":244},22,"https://res-academy.cache.wpscdn.com/upload/kdocshare/2026-11-19/033381a15f2d669c67849cf6de3fab13.webp",962,1245,{"page_no":246,"url":247,"width":248,"height":249},23,"https://res-academy.cache.wpscdn.com/upload/kdocshare/2026-11-19/deb36377e31467455531ad88e36cbc2a.webp",961,1243,{"page_no":251,"url":252,"width":253,"height":254},24,"https://res-academy.cache.wpscdn.com/upload/kdocshare/2026-11-19/25ac0249c041ea35955a29b4566ba510.webp",960,1242,{"page_no":256,"url":257,"width":258,"height":259},25,"https://res-academy.cache.wpscdn.com/upload/kdocshare/2026-11-19/b8fd7b8062a2be19e2e8e0881b37ff0e.webp",959,1241,{"page_no":261,"url":262,"width":263,"height":264},26,"https://res-academy.cache.wpscdn.com/upload/kdocshare/2026-11-19/082e2b3f51b7a551d4ade8980bc3a95c.webp",958,1239,{"page_no":266,"url":267,"width":268,"height":269},27,"https://res-academy.cache.wpscdn.com/upload/kdocshare/2026-11-19/963a90fc7ee97627494dae6f7943bc77.webp",957,1238,{"page_no":271,"url":272,"width":273,"height":274},28,"https://res-academy.cache.wpscdn.com/upload/kdocshare/2026-11-19/4616d7759254c8a9703a86155b429cb3.webp",956,1237,{"page_no":145,"url":276,"width":277,"height":278},"https://res-academy.cache.wpscdn.com/upload/kdocshare/2026-11-19/233a865069ce1bbfcb47517ef5059b81.webp",955,1235,{"list":280,"token":66},[281,286,292,298,304,310,316,322,328,334],{"doc_id":282,"doc_title":283,"file_type":137,"home_preview_img_url":284,"slug":283,"view_count":14,"category_name":30,"create_tm":285},691690,"infineon-aurix-tc2xx-mpu-memory-protection-1-kit-tc297-tft-training-en","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110230002051197/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796114219&Signature=twdPl4R7iR8clNRAsoOC8YuNIXA%3D",1794175731,{"doc_id":287,"doc_title":288,"file_type":137,"home_preview_img_url":289,"slug":290,"view_count":271,"category_name":30,"create_tm":291},81829,"Hawk Harnessing Hardware-Aware Knowledge for High-Performance NPU Kernel Generation","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110229808685457/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796114219&Signature=Mv8K0nUJlVr2OFm5JBo%2FP%2FqBeEc%3D","hawk-harnessing-hardware-aware-knowledge-for-high-performance-npu-kernel-generation",1784176432,{"doc_id":293,"doc_title":294,"file_type":137,"home_preview_img_url":295,"slug":296,"view_count":29,"category_name":30,"create_tm":297},692304,"Node.js Handbook","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110230003199810/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796114219&Signature=QmxxqLGbRMBdmuOzCDmDAaLT3kA%3D","nodejs-handbook",1794192930,{"doc_id":299,"doc_title":300,"file_type":137,"home_preview_img_url":301,"slug":302,"view_count":14,"category_name":30,"create_tm":303},685971,"Practical DirectX 12 - Programming Model and Hardware Capabilities","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110230000305644/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796114219&Signature=3%2BOdrfquaAMT%2BbRE%2BQSvCujzOYI%3D","practical-directx-12-programming-model-and-hardware-capabilities",1794024130,{"doc_id":305,"doc_title":306,"file_type":137,"home_preview_img_url":307,"slug":308,"view_count":24,"category_name":30,"create_tm":309},685892,"Medusa - Simplified Graph Processing on GPUs","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110230000264962/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796114219&Signature=L3jHPle0Y65UYNd8wP2jRo2dvwo%3D","medusa-simplified-graph-processing-on-gpus",1794021609,{"doc_id":311,"doc_title":312,"file_type":137,"home_preview_img_url":313,"slug":314,"view_count":213,"category_name":30,"create_tm":315},203076,"Operating Systems - CEN 308 - Course outline, objectives, and evaluation","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110229882917937/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796114219&Signature=ODDHTfI8ONXCnm0omcJ9%2F6gTF0c%3D","operating-systems-cen-308-course-outline-objectives-and-evaluation",1788555513,{"doc_id":317,"doc_title":318,"file_type":137,"home_preview_img_url":319,"slug":320,"view_count":145,"category_name":30,"create_tm":321},46289,"Windows Internals Part 1 System Architecture Processes Threads Memory Management","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110229798728655/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796114219&Signature=1dmUgu8n8QQU6AAkiTJkTnYSscI%3D","windows-internals-part-1-system-architecture-processes-threads-memory-management",1783516607,{"doc_id":323,"doc_title":324,"file_type":137,"home_preview_img_url":325,"slug":326,"view_count":8,"category_name":30,"create_tm":327},759801,"The Node.js Handbook - Introduction to Node.js","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110230044485168/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796114219&Signature=fqag9Mt82hzPq5U%2FuzUzuJ6%2FjVw%3D","the-nodejs-handbook-introduction-to-nodejs",1795895118,{"doc_id":329,"doc_title":330,"file_type":137,"home_preview_img_url":331,"slug":332,"view_count":261,"category_name":30,"create_tm":333},120793,"In-Memory Computing for Machine Learning and Deep Learning","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110229835370487/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796114219&Signature=q3O8wsmjv7i6smEEUs98d3954Ko%3D","in-memory-computing-for-machine-learning-and-deep-learning",1785732065,{"doc_id":335,"doc_title":336,"file_type":137,"home_preview_img_url":337,"slug":338,"view_count":19,"category_name":30,"create_tm":339},698023,"Intel® Trust Domain Extensions (Intel® TDX) Module Base Architecture Specification - Specification Overview","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110230010162341/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796114219&Signature=d5FGCSF%2B37Df4f9Ul2FIS8Wq0Zg%3D","intel-trust-domain-extensions-intel-tdx-module-base-architecture-specification-specification-overview",1794447168]