Reviewing Eloquent Javascript #IntroChpt
Tags: javascript, review, beginners, eloquentjs
Published: 2020-12-04 19:43:31

**In this blog, I will write on my learnings from the Eloquent Javascript Book's Introduction Chapter.**

Here's the PDF for Eloquent Javascript Book's [Chapter 1](https://eloquentjavascript.net/00_intro.html)

### **TOC**:

1. **What's a Progarm ?**
2. **What are Higher and Lower Level Programming Languages ?**
3. **What is Javascript ?**
4. **Java vs JavaScript** 
5. **JavaScript back in the days**
6. **Where is Javascript used ?** 

## **What’s a Program?**

- A **computer** is a machine whose role is to execute quickly a series of actions given to it. Computers can take in and process certain kinds of information much faster than we can.
- **“Today, computers can learn faster than humans, e.g., (IBM’s) Watson can read and remember all the research on cancer, no human could.”**
- A **programming language** is a way to give orders to our computer. It’s a bit like a human language! Each programming language has its own vocabulary (**keywords** that each play a specific role) and grammar (**rules** defining how to write programs in that language).
- **Programming** and **Problem Solving** increases our **Abstract Thinking**. Abstract thinking is related to thinking in depth. Abstract thinking makes it possible for people to exercise creativity. As the Author says **"A program is a building of thought. It is costless to build, it is weightless, and it grows easily under our typing hands."**
- In the Book its written that **"A program can ingeniously combine an enormous number of these simple actions to do very complicated things."** So it means a complex problem is generally more managable when broken down into simpler subproblems. Then the program will be easier to understand and update.

## **What are Higher and Lower Level Programming Languages ?**

[**Higher level languages**](https://en.wikipedia.org/wiki/High-level_programming_language) can be easily understood or interpreted or compiled by us (Programmers) in comparison to the machine. As well as they Memory efficiency is less.

Examples of Higher Level Programming Languages: 

- Python
- Java
- JavaScript
- C++

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/3wwwqec2yxiuh5951123.jpg)

On the other hand, Machine can easily understand the **[lower level languages](https://en.wikipedia.org/wiki/Low-level_programming_language)** in comparison of Programmers. Here, they are more Memory efficient.

Examples of Lower Level Programming Languages: 

- assembly language
- machine language

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/sdijppu4qj14zbrh2yaa.jpg)

So, I don't know how to write Machine Code but the closet language I know to Machine is the **Assembly Langauge 8086µ** (learned in my College).

So, here's a program to find a factorial of a number.

For those who don't know what is a **factorial of a number**.

- To find the factorial of a number we have to repeatedly multiply the numbers from 1 to the given number.
- For Example: **Factorial of 5 is : 5 * 4 * 3 *  2 *  1 = 120**

```basic
.model small
.code
.startup
main: MOV CX, [0500]
MOV AX, 0001
MOV DX, 0000
MUL CX
LOOP 040A	
MOV [0600], AX	
MOV [0601], DX	
HLT
```

**Code Explanation:**

1. **MOV CX, [0500]** loads the number  to CX Register
2. **MOV AX,** Initialize AX with **0001H**
3. **MOV DX, 0000** lInitialize DX with 0000H
4. **MUL CX**  will multiply AX with CX. "MUL" is the instruction to multiple 2 numbers.
5. **LOOP 040A** runs loop till CX not equal to Zero
6. **MOV [0600], AX** says store lower 16 bit (0600) into AX
7. **MOV [0601], DX** says store higher 16 bit (0601) into DX
8. **HLT** to stop the execution of program

**Here is the same program in JavaScript**

```jsx
let fact = 1;
for (i = 1; i <= number; i++) {
     fact = fact * i;
}
console.log(fact);

if number is 5 
Output : 120
```

**Code Explanation:**

1. let fact = 1; Here we are first initialising fact variable by 1.
2. Then we require way to loop from 1 to the number to multiply the number repeatedly.
3. After that, we will multiply the loop counter `i` with `fact` and will store the result in `fact`
4. console.log operation will display the value of  `fact`

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/ivdcph838627uqr19ty7.jpg)

## **What is Javascript ?**

- Javascript is the programming language of the **web**.
- JavaScript is the web scripting language developed by **Netscape**. It is the most [popular programming language](https://insights.stackoverflow.com/survey/2020/) in the world today. The language was standardized to [ECMAScript](https://en.wikipedia.org/wiki/ECMAScript), as a cross-platform Internet standard for scripting, but it is still most commonly called JavaScript.

## **Java vs JavaScript**

A lot of people ( including me ) at the Beginning confuse JavaScript with Java and are under the impression that JavaScript is a ‘scripting’ version of Java. But what Java is to JavaScript is what car is to carpet ( #lamejokes ). They don’t have anything to do with each other.

## **JavaScript back in the days**

- JavaScript is first and foremost the programming language of the **web**. It was invented in **1995** by **Brendan Eich**, who at the time worked for Netscape, which created the first popular web browser (**Firefox’s ancestor**). Also,which means that Javascript is **24 years old** now!
- While its first official name was **LiveScript** in the beta releases of **Netscape Navigator**, the marketing machine of Netscape later altered its name to JavaScript.
- Today, **browsers** mostly use the fifth edition of the **ECMAScript (ECMA-262) specification**.

## **Finally, Where is Javascript used ?**

- JavaScript is said to be the **de-facto** **assembly** of the **web**.
- Web browsers are not the only platforms on which JavaScript is used. Emergence of the **[Node.js](https://nodejs.org/en/)** platform,allowed us to create JavaScript applications outside the browser.
- **Server Applications** using **Node.js**
- **Gaming Applications** for Broswer as well as there are some [**PhysicsJS**](http://wellcaffeinated.net/PhysicsJS/),[**Pixi.js**](https://www.pixijs.com/) JavaScript game engines available.
- We can also create **Machine Learning Models** using **[Tensorflow.js](https://www.tensorflow.org/js)**
- **Mobile Applications** using **[React Native](https://reactnative.dev/)** and **[Ionic](https://ionicframework.com/)**
- **Desktop Applications**: **[Electron](https://www.electronjs.org/)** , **[NW.js](https://nwjs.io/)**, [**AppJS**](http://appjs.com/) are some JavaScript frameworks.
- Some **databases**, such as **[MongoDB](https://www.mongodb.com/)** and **[CouchDB](https://couchdb.apache.org/)**.

Yes, So that's all these are my key Learning from the Introduction Chapter of Book Eloquent Javascript. Also, Please do share your key learning from the Intro Chapter and what did you understood the most. 

Please note that I don’t claim to have the best solution for Problems written in this blog. I’m more than happy to see other solutions as well.

This is a **Bloging Challenge** from **#teamtanayejschallenge**

Here's a link to the Website: **[https://ejs-challenge.netlify.app/](https://ejs-challenge.netlify.app/)**

### References:

[JavaScript](https://developer.mozilla.org/en-US/docs/Web/JavaScript)

[Abstract Thinking - GoodTherapy.org Therapy Blog](https://www.goodtherapy.org/blog/psychpedia/abstract-thinking)

[Computation Power: Human Brain vs Supercomputer](https://foglets.com/supercomputer-vs-human-brain/)

[Are Computers Already Smarter Than Humans?](https://time.com/4960778/computers-smarter-than-humans/)

**Thank you very much for the patience. I’d love to hear your feedback about the post. Let me know what you think about this article, and javascript in general, through my [Twitter](https://twitter.com/NawarPrerana) and [LinkedIn](https://www.linkedin.com/in/prerana-nawar-4890b41ab/) handles. I would love to connect with you out there!**

**Peace!**