# JS working

#### What is Program?

* allocating memory ( for variables ).
* parsing (read) and executing (run)

#### JavaScript Engine:

* Memory Heap
* Call stack

#### Memory Leak:

When the unused variables are increased with huge data, this occurs. so global variables are not preferable.

#### Call Stack:

Reads the function and push it into the stack, executes the function and pops out the stack.

First In Last Out or Last In First Out.

#### Single Threaded:

It means having only one call stack.

#### Why Single thread?

Running a code in single thread is quite easy, since it don't have to deal with complected scenarios that rise in multi threaded environment. We have one thing to worry about. We can avoid deadlock as it is in Multi threaded.

#### Synchronous:

Code is executed only after the previous line of the code is executed.

#### Stack Overflow:

It is occurred when the call stack is full, no space for the execution.

#### JavaScript Run-Time:

![JavaScript Run-Time](https://2037876129-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LdbqCujxzeJqeQqlbM2%2F-LnlJzpqYgGbNg_DPny9%2F-LnlSJ0jM70z27GTzOrN%2Fimage.png?alt=media\&token=d540639c-5ade-4b4e-ada9-041eb64abe9e)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://javascript-1.gitbook.io/javascript/js-working.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
