Introduction To JavaScript
JavaScript is the programming language mainly used as a scripting language for web pages, and this is an interpreted compiled programming language. When we consider about JavaScript, can be used for client side developments as well as server side developments. These are programs which run using a single thread. Since, JavaScript is a single-threaded language, it is synchronous in nature. So, it can be really easy to implement.
If you are a beginner, I would like to explain what is called single thread. Java script has different engines to implement. As an example, in the chrome browser, JavaScript is implemented by v8 engine. V8 engine has two parts called Memory Heap and Call Stack. Js code will be execute and run line by line from the call stack. Single threaded means, it has only one call stack. This is beneficial because it is really easy to implement and it is less complicated.
JavaScript is object-oriented. Object, classes, encapsulation and inheritance are some features that make JavaScript object-oriented. We use objects to contain property and method. Wrapping functions and properties to a single unit by using code is called as encapsulation. Inheritance is the concept in which some property and methods of an Object is being used by another Object.
There are many pros and cons in JavaScript. First of all, we will talk about pros. JavaScript use less time to compile because it is interpreted language. So, we can mention speed as an advantage. This is a very popular language because popular companies such as Google, PayPal and Amazon use JavaScript as a tool. Also, JavaScript is versatile because it can be used to develop the front-end as well as back-end. When we use JavaScript to design websites, it will be catchy when we use components such as siders and drag and drops. So, we can consider rich interfaces as an advantage.
When we talk about cons, there is a security problem because the code is visible to the client-side. Another disadvantage is there is lack of debugging facility in JavaScript. Also, JavaScript only supports single inheritance.
In conclusion, JavaScript has so many advantages and it has disadvantages as well. But this is the most powerful and flexible language.