I started reading out this book a week ago and here I'm trying to break-up a few things I understood while getting started.
Chapter 01 : Introduction to JavaScript.
JavaScript is a high-level, dynamic, interpreted programming language that is well suited to Object oriented and functional programming styles with multi-paradigm. It has curly-bracket syntax, prototype-based object-orientation, and first-class functions. It is basically everywhere around us.
I know what you're thinking. Alright, I accept these are a lot of jargons to take in abruptly. So let's get our feet into the deep waters one foot at a time.
What is High-level Programming language?
In computer science it can be explained as a programming language that uses abstraction(providing relevant information in a type). Means we all know machine cannot understand natural languages that humans speak. They only understand the binary or machine level language, which consists of only zeroes and ones. Now what earlier software engineers did for us was they kind of made a dictionary in which they wrote down sequences of 0's and 1's so that when we type something in our natural language the machine will have a reference to look up to, to understand what it exactly means in machine level language.
A dynamic programming language is nothing but just a class of high level programming language in which operations otherwise done at compile-time can be done at run-time. In JavaScript it is possible to change the type of a variable or add new properties or methods to an object while the program is running. This is the ability of a dynamic language.
Interpreters run through a program line by line and execute each command so if a command in JavaScript is executed, that is done in the manner previously mentioned and thus becomes an interpreted language. The point to note here is that in compiled languages that are directly converted into machine code, they tend to be faster than interpreted languages. But with the development of JUST-IN-TIME compilation the gap is shrinking.
Chapter 02 : Lexical Structure.
When learning any new language one needs to keep in mind that every language in this world has a particular script and a particular set of defined rules on which the whole language relies upon. Like you know how American English has the same letters as British English but still both are different in ways. Pronunciation, spelling of particular words etc. Similarly in every programming language there is a set of elementary rules that specifies how you write programs in a particular language. This is called lexical structure or in simple words its syntax. Important points to remember are that :
- JavaScript is a case-sensitive language.
- JavaScript ignores excess whitespace along with line breaks except for those that are a part of string or regular expression literals.
- Currently according to ECMAScript 6 there are total of 48 reserved keywords in JavaScript.
- JavaScript programs are written using the Unicode character set.
- Semicolons are optional.
- Primitive types (inbuilt or predefined datatypes and methods linked to them).
We will continue to discuss the further chapters.
If you think this article can be improved do let me know. π
Top comments (4)
Nice, π, So
Javascript
andPyhton
being a interpreted language is slow compared to compiled languages likeC, C++, C# and Java
?Then how come
Node.Js
is fast, its alsoJavascript
right ?Take a look here:
Why is this NodeJS 2x faster than native C?
For the sake of a presentation at work, I wanted to compare the performance of NodeJS to C. Here is what I wrote:
Node.js (for.js):
β¦As you can find there, compiled languages can get optimized really well as they are getting compiled. The question shows that without any optimization, they have similar results in execution time, with JS/Node getting ahead even!
But the C optimized by the compiler can shave off half it's run time, leaving JavaScript and Node in the dust.
This optimization in compile time is impossible for languages that are compiled just in time (JIT) like JavaScript/Node
So, while JS/Node are not slow per se, they can't ever be as fast as compiled languages.
Topic is getting hot, Today i read this post which said JS is a compiled language but here i read JS is a interpreted language. There is lot of confusion going on this topic.
JS
is a interpreted language.JavaScript (JS) is a lightweight, interpreted, or just-in-time compiled programming language with first-class functions.
softwareengineering.stackexchange....
blog.greenroots.info/javascript-in...
Is there single source of truth for Javascript like a official document ?
I think
Mozilla
statement is correctJavascript
isjust-in-time compiled
at run time and thus not fully compiled at build time like other compiled languages.You should refer to MDN docs since the creators of javascript previously which introduced netscape are the in hold of Mozilla