Skip to main content

Command Palette

Search for a command to run...

Before you write the code in JS

Updated
2 min read
Before you write the code in JS
B

BSc CSIT Graduate

Here’s a simple fact:

Programming is all about:

What we should do with what?

a. Data (numbers, text, true/false…)

b. Processing (loops, functions, etc.)

Let's talk about terminologies:

  1. Data type: Data types are like labels that tell the computer what kind of value a variable holds. They define
    a. What kind of data can be stored (numbers, text, true/false, etc.)
    b. What operations can be done on that data

  2. Context: It is the environment in which a piece of code runs. It consist of :
    a. execution thread and
    b. memory

  3. Global Context: This is the default context when code runs outside any function. In browsers, this in global context refers to the window object. Variables and functions declared globally belong to this context.

  4. Local Context: When code runs inside a function, it has a local context.

  5. Execution Thread : An execution thread is the part of the JavaScript engine that runs your code line by line. It is like the “worker” that executes instructions in your program.
    Main thread and local exectuion thread are it's type.. based on the context.

  6. Call stack: It is a structure in js that keeps track of funcitons. When function is encountered by exectuion thread(main thread), it pushes the function in to the stack. This call stack works in LIFO manner. After the execution function is popped out.