DEV Community

Cover image for Eloquent Javascript Review #Introduction
Sobhan Dash
Sobhan Dash

Posted on • Updated on

Eloquent Javascript Review #Introduction

In this blog, I'm going to write my thoughts and learnings on the introduction chapter of Eloquent JS book.

TOC:

  1. What is a Program?
  2. Why Programming languages are used?
  3. Java and JavaScript are the same?
  4. What is JavaScript?
  5. Where is JavaScript used?

TL;DR
JavaScript is a high level language with multiple functionalities in web development, game and mobile app development, machine learning. It was founded in 1995 by Netscape.

What is a Program?

Well you can obviously search for it but simply put a program is something that instructs a computer to do a certain task. There are different types of programs and different ways to implement them but every program has an essential goal to its existence, to solve some kind problem.

Why Programming language are used?

Alt Text
Talking to computers is tough. They don't understand our human language and honestly they are like a baby, whatever you tell them to do they do that (still a reach because they won't do anything if your don't instruct them)
Traditionally there was a long process to execute even the simpler of programs. It was tedious and error prone. One such example would be finding the factorial of a number using assembly language.

Factorial of 8: 8*7*6*5*4*3*2*1=40320

.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
Enter fullscreen mode Exit fullscreen mode

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

Now let's see the same program in JavaScript:

let fact = 1;
var number = prompt("Enter the number ");
for (i = 1; i <= number; i++) {
     fact = fact * i;
}
console.log(fact);

if number is 8
Output : 40320
Enter fullscreen mode Exit fullscreen mode

Code Explanation:

1- let fact = 1; Here we are first initializing fact variable by 1.
2- Then we ask the user for a number using prompt function.
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

So, new programming languages helps omit unnecessary details, and makes them readable in high level language.

Java and JavaScript are the same?

Alt Text
No, both are completely different programming languages. This confusion remains among many new coders because they think JavaScript is a scripting language version of Java. But the name Java was included because by the time JavaScript launched Java was growing at a rapid rate. And the makers of JavaScript thought of an interesting marketing idea and rode along the success of Java.

What is JavaScript?

JavaScript is a high level language created in 1995 by Netscape Navigator Browser. It was used to introduce programs to web pages.
It meant applications can be interacted without reloading the page for each and every action.
It was later adopted by other major graphical web browsers and has since been booming at a rapid rate. There's another name for JavaScript and that is ECMAScript.

ECMAScript and JS are names for the same language. JavaScript had to be standardized after it's popular adoption and it was done by Ecma International Organization. Hence the name ECMAScript

JavaScipt is usually considered a bit tough for beginners because it would not point out your errors and finding them is the real challenge in programming. So if you want to learn JS have some patience. If you already know then share your first experience down in the comments.

Where is JavaScript used?

JavaScript is not only used in web browsers but other platforms also use it. Some implementations are:

  • Some databases, use JavaScript as their scripting and query language, such as MongoDB and CouchDB.
  • Node.js allows us to write JS outside the browser in its own environment.
  • Machine Learning can also be done using Tensorflow.js
  • Mobile Applications using React Native and Ionic

So that's the introduction part of Eloquent JavaScript book. These are the key takeaways that I found out from my read. Do let me know your thoughts on the language! Do follow my Twitter and LinkedIn handles.

Top comments (0)