DEV Community

Cover image for Introduction to Javascript
RoyfordWanyoike
RoyfordWanyoike

Posted on

Introduction to Javascript

Introduction to ultimate javascript 101

Javascript (JS) is a high-level, interpreted programming language used in web development.
It is a language which is also known as dynamic, loosely typed and multi-paradigm. It is different from Java and it focuses much on the web. The two are different in concept and design.
History of Javascript

Javascript was invented by Brendan Eich back in 1995.It was converted to ECMA standard script in 1997. ECMAScript is the official name of the language.

  • The Original JavaScript ES1 ES2 ES3 (1997-1999)
  • The First Main Revision ES5 (2009)
  • The Second Revision ES6 (2015)
  • The Yearly Additions (2016, 2017, 2018)

Javascript offers all modern browser. These include chrome, internet explorer, microsoft edge, firefox, safari browser for apple and also the opera browser. it is used in many databases like CouchDB and MongoDB as their scripting and query languages.

## Usages of Javascript

  1. Client-side validation
  2. Dynamic drop-down menu
  3. Displaying date and time at any moment
  4. Validate user input in an HTML form before form submission(sending the data to a server)
  5. Build forms that respond to user input without involving a server request
  6. Change the appearance of HTML elements
  7. Open, close and redirection of new windows or frames
  8. Manipulate HTML layers like hiding, moving, and allowing the user to drag them around a browser window
  9. Build complete client side programs
  10. Displaying popup windows and dialog boxes (e.g., alert dialog box,confirm dialog box and prompt dialog box)
  11. Displaying clocks

Pros of Javascript

  • Speed. Client-side JavaScript is very fast because it can be run without server-side access.
  • Simplicity: JavaScript is easier to learn and implement.
  • Popularity: JavaScript is used almost everywhere in web design and development industry. Stack Overflow and GitHub have many projects using JavaScript. The language has gained a lot of traction in the industry in recent years.
  • Interoperability: JavaScript can be inserted into any web page regardless of the file extension or inside scripts written in other languages like Perl and PHP.
  • Server Load: Being client-side reduces the demand on the website server thereby decreasing overall load.
  • Rich interfaces: Drag and drop components or slider gives a rich interface to your website with the use of JavaScript.
  • Extended Functionality: Third party add-ons like Greasemonkey has enabled JavaScript developers to write of JavaScript snippets that can be executed on desired web pages to extend its functionality.
  • Versatility: There are many ways to use JavaScript through Node.js server nowdays e.g., if it is bootstrap node.js with Express, a document database like mongodb must be used. JavaScript is also used in the front-end for clients. It is possible to develop an entire app from front to back end using only JavaScript.
  • Updates: Since the advent of EcmaScript 5, ECMA International has dedicated to continue updating JavaScript annually. ** ## Disadvantages/Cons of JavaScript **
  • Client-Side Security: As the code is executed on the users’ computer, in some cases it can be exploited for malicious purposes which are not desirable.
  • Browser Support: JavaScript is interpreted differently by different browsers whereas server-side scripts will always produce the same output. Client-side scripts can be a little unpredictable.

Getting started with mighty Javascript
To understand javascript you need have some understanding of html and css. This is because javascript will be used to render pages andd make them responsive.

Type this code on the editor.

<html>
<body>
<h2>Welcome to JavaScript</h2>
<script>
document.write("Hello JavaScript by JavaScript");
</script>
</body>
</html>
Enter fullscreen mode Exit fullscreen mode

Output

Welcome to JavaScript
Hello JavaScript by JavaScript
Enter fullscreen mode Exit fullscreen mode

In the above code there are html tags and javascript code. The javascript code are enclosed in script tags.

<script>
document.write("Hello JavaScript by JavaScript");
</script>
Enter fullscreen mode Exit fullscreen mode

Applications of Javascript

  • Client side validation - This is really important to verify any user input before submitting it to the server and Javascript plays an important role in validting those inputs at front-end itself.

  • Manipulating HTML Pages - Javascript helps in manipulating HTML page on the fly. This helps in adding and deleting any HTML tag very easily using javascript and modify your HTML to change its look and feel based on different devices and requirements.

  • User Notifications - You can use Javascript to raise dynamic pop-ups on the webpages to give different types of notifications to your website visitors.

  • Back-end Data Loading - Javascript provides Ajax library which helps in loading back-end data while you are doing some other processing. This really gives an amazing experience to your website visitors.

  • Presentations - JavaScript also provides the facility of creating presentations which gives website look and feel. JavaScript provides RevealJS and BespokeJS libraries to build a web-based slide presentations.

  • Server Applications - Node JS is built on Chrome's Javascript runtime for building fast and scalable network applications. This is an event based library which helps in developing very sophisticated server applications including Web Servers.

Javascript Development Tools

You can use the following editors to run javascript code.

  • Atom download here
  • visual studio which can be downloaded here
  • webstorm here

The next tutorial we will be diving on the Javascript variables.

Contact
Twitter Roy Wanyoike

Top comments (0)