Ayush Thakur
Ayush Thakur

@JSAyushThakur

10 Tweets 18 reads Mar 31, 2023
How JavaScript works (Behind the scenes)
Thread🧵👇
1️⃣ What is JavaScript
➡ JavaScript is a client-side scripting language and commonly used scripting languages
➡ JavaScript runs on the client-side (on the client machine) inside the browser
2️⃣ Browser Support
➡ Client's browser should support the JavaScript or must have JavaScript enabled in it
➡ Every modern-day browser has JavaScript engine in it to support the JavaScript
➡ For eg, Google Chrome has it's JavaScript engine named V8
3️⃣ JavaScript Engine
➡ When a browser gets a JavaScript code, the code is examined by the JavaScript Engine
➡ In JavaScript Engine, the code goes through 4 steps - Parser, AST, Conversion to Machine Code, Machine Code
STEP 1 - Parser
➡ Parser checks the whole JavaScript code and look for any syntax errors
➡ If any error is found, it throws an error and stops the execution
STEP 2 - AST
➡ AST stands for Abstract Syntax Error
➡ Once parser checks the code, it creates the data structure called as AST
STEP 3 - Conversion to Machine Code
➡ After the AST is created, JavaScript engine converts the code into the Machine Code
➡ Machine code is the language that machine can understand
STEP 4 - Machine Code
➡ After the conversion to Machine code, the code is sent for final execution
➡ Once the final execution is successful, the output is displayed on the browser
Thank you for reading the thread ☺️
If you like it then do give the first tweet a RETWEET 🙌

Loading suggestions...