JavaScript: Where & How?

JavaScript: Where & How?

4 min read

In this article I will demonstrate where you can check or run your JavaScript (JS) code if you have just started (I am talking about beginners and there is something new and interesting for intermediates also!). And we will also deal with some of the basic syntax required for starting your coding journey using javascript.

It is well known and as obvious that all web browsers can run JS and typically all devices have web browsers on them.

Or particularly you can choose :

--> Sublime-text (code editor)

--> Visual Studio Code (code editor)

--> Atom (code editor)

--> Notepad (Easy! But write extension <name>.html when saving in notepad)

@java script

Here you can create HTML file so as to open in web-browser and for explaining point of view, you can look at this simple script:

<script>
console.log(“JavaScript”)
</script>

Open this file in web browser ( the name of your file <name> appear in desktop with your browser symbol ). Then you probably say “Oh!  This page is empty” (bro this is JS).

So you should open JS console first by pressing :

--> ctrl + shift+ j [ Window / Linux ]
--> cmd + opt + j [ Mac ]
@JS in windows

Or there is another easy way around you can use the code  editor available on freeCodeCamp.org or use codepen.io or scrimba.com (you probably have to create account and login to use their code editor)

Comment Your JS Code

Use ‘//’ or ‘/*…*/’ for commenting your code and it is exactly the same comment you use in C & C++ for explaining your particular code line, like:

var vishal = 1 ; // in-line comment
/*  this is  multi-line
comment    */

7 Data Types in JS

/* string, undefined, null, Boolean, symbol, number and object                   
There are three ways to declare a variable :
var
let
const 
Each has its own specification check out here.
*/
var myName = “keshav”;
myName = 1;
let fanName = “Chandu”;    // it is declared within the scope you declare it

const e = 2.718281828459045235; // variable that can never change

Example of how to store value with Assignment Operator

var keshav;   // declaration
var vishal = “Awesome”;  //Assignment
console.log( vishal );    //Awesome
console.log( keshav );   //null

Note : Here is an obvious thing but it will not skip if I specify here – you can initialize and declare variable in one line like :

var a = 1 ; //initializing  a as a variable and declaring its value 1

Case Sensitivity is important

You can’t ignore the manner in which you have initialized you variable for example:  

var bigFanOfYou;

bigFanOfYou = “TONY STARK”; // here casing in bigFanOfYou matters

Escaping Sequences

The escape sequences are all same which you have learn earlier that are:

/*-------------------
\’ single quote
\\ backslash
\n newline
\r carriage return
\t tab
\b backspace
\f form feed
---------------------*/

Others

You can increment, decrements, add, subtract, multiply, divide & modulo two variables in the same way you do in C/C++

There is lot more to cover and for the time being  let’s stop our discussion here and in near future I will update it with more content and will let you know about this in comment box or in social media. And as always your suggestions or any error corrections are most welcomed at here. You can even connect with me through LinkedIn 🙂 . 

And you can check this video for reference:

Introduction to JavaScript
@source freeCodeCamp YouTube

Here are the code editors you may check:

https://scrimba.com/

https://jsfiddle.net/

https://www.w3schools.com/tryit/

https://codesandbox.io/

Choose your Reaction!
Leave a Comment