DEV Community

SHEM MAINA
SHEM MAINA

Posted on

INTRODUCTION TO MODERN JAVASCRIPT

**

WHAT IS MODERN JAVASCRIPT?

**
On top of the ECMAScript specification, JavaScript is commonly abbreviated as JS. It is a popular, interpreted programming language. It's a multi-paradigm language that's open source, cross-platform, high-level, and typically just-in-time compiled. It is easy to use because it is integrated with HTML. Curly-bracket syntax, dynamic typing, prototype-based object orientation, and first-class functions are all features of this language.

**

APPLICATIONS OF JAVASCRIPT

**
JavaScript is being utilized across a variety of platforms, despite the fact that it was meant to work in a browser environment. Listed below are a few examples:

  • Web server
  • Browser addons/extensions
  • Mobile applications
  • Databases consoles
  • OpenOffice scripts/macros
  • Java applications

**
**

GETTING STARTED

**
As a beginner, you should have a text editor which you will use to write your scripts. Java script scripts can be embedded inside the html page or written in an external sheet then linked to the html file.
For example in vs code, you have to install javascript extensions from the market place and it will be easy for you to run your code.
Here is a link to a video detailing on getting started on javascript and how to go about it in vs code.
https://www.youtube.com/watch?v=x_2sYpk75Ic&t=324s

General syntax

**
Case is important in JavaScript. The semicolon ; marks the end of each line. Curly brackets are used to separate blocks. For multiple lines, comments are placed between /* /, and for single lines, they are placed after /.
*

VARIABLES AND DATATYPES
**
The case of a word in JavaScript matters. The semicolon ; at the end of each line signifies the end of the line. Using curly brackets, block is delimited. For many lines, comments go between /* */, and for one line, they go after /.

Datatypes in javascript include;

  • numbers
  • string
  • boolean
  • null and undefined

ARRAYS**

**
An array is a special variable, which can hold more than one value:

const cars = ["Saab", "Volvo", "BMW"];
Enter fullscreen mode Exit fullscreen mode

Arrays in javascript can be manipulated in the following ways;
Writing and reading
Insertion and deleting

OPERATORS

Operators are really powerful in JavaScript. Unlike in some other languages, operators are not only used to do maths, they are also very useful with strings.
Some of the type of operators in javascript include;

  1. arithmetic operators
  2. comparison
  3. logical
  4. bitwise
  5. equality
  6. assignment

STATEMENTS

Conditional statements in javascript are just like in many other languages. They execute after evaluating a given set of conditions and give a certain output.
They include;

  • for
  • if...else
  • switch

FUNCTIONS

A function is a predefined chunk of code that can be called and run multiple times to complete certain tasks.
JavaScript functions allow you to extract code, label it, and refer to it in other places.
The function keyword is used to define a JavaScript function, which is then followed by a name and parenthesis ().

Letters, numerals, underscores, and dollar signs can all be used in function names (same rules as variables).

Parameter names separated by commas may be included in the parentheses: (parameter1, parameter2, ...)

The function's code to be run is enclosed in curly brackets: {}

FRAMEWORKS

For creating a dynamic modern application, real-time chat, eCommerce, inventory, processing, and much more, JavaScript (JS) frameworks are the chosen platforms.
Some of the frameworks include;

  • AngularJS
  • Sencha Ext
  • React
  • Ember.js
  • Vue.js

To learn more about javascript, you can refer to javascript documentation on the internet and different tutorials.
Here is a link to some of the most comprehensive javascript tutorials
https://www.w3schools.com/js/default.asp --w3schools
https://devdocs.io/javascript/ -- javascript documentation

Oldest comments (0)