LET’S TALK JAVASCRIPT!
Understanding javascript, its features and why you should choose javascript.
Hello,
This is going to be a conversational article that would convince you to fall in love with javascript for its utility and functionality. you’re about to understand the concept of javascript, its history, core features and attributes.
Ready?I guess so.
Before you start learning something new, it’s important to understand exactly what it is and what it does. This is especially useful when it comes to mastering a new programming language. If you don’t do this, you’ll never truly fall in love with that programming language. Let’s start with defining javascript. What is javascript?
JavaScript is a just-in-time (JIT) compiled, multi-paradigm programming language with dynamic typing. Combined with HTML and CSS, JavaScript is one of the leading technologies used in the World Wide Web. Let me break this down in simpler terms.
Javascript is a programming language used to make websites interactive. If you think about the basic makeup of a website, you have HTML, which describes and defines the basic content and structure of the website, then you have CSS, which tells the browser how this HTML content should be displayed — determining things like colour and font. With just HTML and CSS, you have a website that looks good but doesn’t do much.
JavaScript brings the website to life by adding functionality. It’s is responsible for elements that the user can interact with, such as drop-down menus, modal windows, and contact forms. It is also used to create things like animations, video players, and interactive maps.
An even better way of understanding what JavaScript does is to think about certain web features you use every day and likely take for granted — like when your Facebook timeline automatically updates on your screen or Google suggests search terms based on a few letters you’ve started typing. In both cases, that’s JavaScript in action. we call it the language of the web.
JavaScript isn’t only used to create websites. It can also be used to build browser-based games and, with the help of certain frameworks, mobile apps for different operating systems. The creation of new libraries and frameworks is also making it possible to build backend programs with the language, such as web apps and server apps.
If you’re having doubts about this language, don’t. It’s important to note that since its creation in 1995 JavaScript is pretty much everywhere on the web — and that’s not likely to change any time soon. Brendan Eich created JavaScript in 1995 while he was at Netscape Communications Corporation, the creators of the legendary Netscape Navigator web browser. At the time, the Java coding language was rapidly gaining traction.
However, Java was too large and too complex to appeal to amateurs, scripters, and designers. In order to solve this problem, Netscape contracted Brendan Eich to design a versatile programming language that could speed up web development and serve as a scripting companion for Java.
This first version of JavaScript defined the many great traits (such as its object-model) this coding language is known for today. It also boosted a number of powerful features that would eventually enable it to outgrow its original purpose. As javascript kept evolving, new features were introduced to make it way better for developers. The most recent update was the ES6 javascript update that came with a lot of amazing modificaftions of the language. it is truly a unique language. what makes it a unique language?
let’s look at the core features of javascript.
i. Scripting Language:
Scripting languages are coding languages used to automate processes that users would otherwise need to execute on their own, step-by-step. Short of scripting, any changes on web pages you visit would require either manually reloading the page, or navigating a series of static menus to get to the content you’re after.
A scripting language like JavaScript (JS) does the heavy lifting by telling computer programs like websites or web applications to “do something.” In the case of JavaScript, this means telling the program to do whatever it is they do — like telling images to animate themselves, photos to cycle through a slideshow, or autocomplete suggestions to respond to prompts. It’s the “script” in JavaScript that makes these things happen seemingly on their own.
ii. Interpreter Based Language:
JavaScript is an interpreted language instead of a compiled one. In that sense, it is closer to languages like Ruby and Python. The browser interprets JavaScript’s source code, line by line and runs it. In contrast, a compiled language needs to be compiled into a byte-code code executable before it is run. An example of such is C++ or Java which needs to be compiled before it is run. The source code is passed through a program called a compiler, which translates it into bytecode that the machine understands and can execute.
For further indepth understanding, you can read all about the differences between a compiler and an interpreter here.
iii. Client-Edge Technology:
The client is basically a term used for Web Browser in respect to the User. The data on the server gets uploaded by a client which is later used by a user in the rendered form. The user gets access to the client through a web browser for surfing and interacting through websites. The client edge technology in Java Script permits the client to have full control over the content material that is being updated in servers. let’s just say the“The client has an edge”.
The person receives get access to the customer through a web browser for browsing and interacting through websites.
iv: Prototype-Based Language:
javaScript is one programming language that supports a prototype-based inheritance model. This model encourages the developers to focus on the behaviour of an application first and then worry about grouping these objects into a much formal system of classification such as classes. JavaScript also lets altercation of prototypes at runtime as well.
As you would know, everything in JavaScript is an Object & when it comes to inheritance it uses Object as its only construct. Every Object holds a private property called a prototype holding a reference to its base object type. This prototype object in turn can have its own prototype object & so on till it reaches a point where the prototype is null which is the final link. This is referred to as Prototype Chain in JavaScript.
The APIs to read the prototype of an object are as below as per ES2015(javascript feature update):
Object.getPrototypeOf();
Object.setPrototypeOf();Some examples:
const foo = {fooProp:true}
const bar = {barProp: true}/* logs the prototype of 'foo' */
console.log(foo.__proto__);
console.log(Object.getPrototypeOf());/* try to access 'foo.barProp'
* returns 'undefined'
* as 'barProp' is not a defined inside 'foo'
*/
console.log(foo.barProp);/* lets change the prototype of 'foo' */
Object.setPrototypeOf(foo, bar);/* Now, lets check again
* it will return 'true'
*/
console.log(foo.barProp);How does the example above print the value of foo.barProp? When the property is accessed from an object, it’s looked up in the object first and if it's not found in the Object, the lookup is extended in Object’s prototype and its prototype and so forth till the prototype is null. Even the methods can be reused and extended in the same way, as there is no class method principle in JavaScript and the method is like another property for an Object. Thus achieving behavior or logic reuse without class-based inheritance.
Get JENNIFER JOSEPH’s stories in your inbox
Join Medium for free to get updates from this writer.
When an inherited function is executed, the this value will be pointing inherited object & not the prototype object where the function was defined.
This behaviour is similar to the Object factory method, and thus such a design pattern is commonly seen in JavaScript code. When we say that javascript is an object oriented programming language, it means that everything in Javascript is an object, each object holds a reference to another object, which can inherit behaviour and value. This behaviour makes javascript really flexible and easy to manipulate language at the same time.
V. Validation of User Input/Form validation:
Form validation performs the accuracy check on forms created and checks whether the user-submitted information is correct. Previously, validation used to occur at the server, after the client had entered all the necessary data and then pressed the Submit button. If the data entered by a client was incorrect or missing, the server would have to send all the data back to the client and request that the form be resubmitted with correct information. This was really a lengthy process which used to put a lot of burden on the server.
Now, JavaScript provides a way to validate form’s data on the client’s computer before sending it to the web server. Form validation generally performs two functions.
- Basic Validation − First of all, the form must be checked to make sure all the mandatory fields are filled in. It would require just a loop through each field in the form and check for data.
- Data Format Validation − Secondly, the data that is entered must be checked for correct form and value. Your code must include appropriate logic to test correctness of data.
This is a feature of javascript that makes it more desirable than other programming languages.
VI. Handling Events:
An event is an action or an occurrence in a system that communicates about the occurrence so that you can respond to it somehow. For example, a user clicks on a button, and the system tells you to respond to the button click event with an action, say an information box. it controls the response on the website when the user tries to perform any operation like clicking on links and options, interaction response over the website, etc.
VII. A Light-weight language:
JavaScript (JS) is a lightweight, interpreted, or just-in-time compiled programming language with the best features. Whilst it is the most popular scripting language for net pages, many non-browser platforms additionally use it, together with Node.js, Apache CouchDB, and Adobe Acrobat.
JavaScript does not have too many language set up that we could use for building your code.
it has functions, unique forms of loops that may be used in different types of information systems, and constructed in items like Dates, Array, etc.Also, declarations (like const, let) statements (like if-else), and are available for generating variables. At first glimpse this may not sound important but when you get into the crux, you’ll appreciate it.
VIII. Control Statements:
JavaScript is equipped with control statements like if-else-if, switch-case, and loops like for, while, and do-while loops. These control statements make it a powerful programming language, enabling its user to write complex logic. you can read more about control statements here.
WHY SHOULD I CHOOSE JAVASCRIPT?
I’ll tell you why!
I. One language for frontend and backend!
JavaScript was originally introduced as a front-end interpreted language. It’s main goal is to bring interactivity with users by bringing features like event handling, forms, browser handling and document (HTML) handling. This continue to be true with 94.5% of world’s top 10 million websites use JavaScript in the frontend. We can even go ahead and say JavaScript is the only interpreted language that is universally accepted by all web applications and browsers.
When it comes to backend there were already many languages existing (PHP, Java, Ruby, Python etc..). So the norm was to learn one programming language for front end and another one for backend. This got changed with the introduction of node.js (which is a JavaScript runtime environment), which has emerged as the #1 framework by developers. JavaScript is also one of the fastest growing OpenSource (ranked 4th) that enables developers to build scalable, lightweight web applications with ease. With these unique advantages, JavaScript scores significantly higher than Java by emerging as the only language that can be used both in frontend and backend programming. This has truly enabled fullstack web development phenomenon!
II. JavaScript is in demand!
Programming, in general, is in demand these days but particularly website front-end development is in high demand. Guess which programming language is used in Front-End Development and even backend development? JavaScript.
The good news for you is that there are many employers looking for skilled developers, this makes it easier for newer developers to quickly get a job. Employers are forgiving because they need these skilled people who are difficult to find. Once you have the right skills, getting a job is easier.
III.Javascript is Easy to Learn!
Yes! you heard right!. it is easy to learn javascript!. It has been seen that a lot of developers don’t know the basics of JavaScript even after some previous experience in coding. JavaScript is comparatively easier to learn than other programming languages. It’s beginner-friendly and anyone can start learning it without any previous experience in coding. Generally beginners in coding struggle with some environment setup or set up in the code editor to run the program. But JavaScript works in the browser and you don’t need to do any kind of specific setup to run your program.
JavaScript is a high-level language so you don’t need to deal with so many complexities in your code (handled by the machine instead of in your code). You can learn the fundamentals of JavaScript within a few months and you can build the application or start creating simple programs on your own.
Go and conquer javascript! I wish you absolute success in this career path!






