Javascript 101 — History, Javascript Console, Data Types, Variables — 01
These notes are for Javascript 101. During my penetration test on websites, Javascript came complex so I decided to focus here on some basic information about it and syntax.
The history of Javascript can be complicated but simply we can say that LiveScript, Mocha-Dev Name, JScript, Javascript is all same. But the most confusing one, Javascript and Java are not the same.
How does it work?
Our browsers have three components these are DOM parser which parses HTML, other one CSS parser which parses CSS and gives our HTML code more readable vision and browsers have Javascript Engine which takes javascript code and run it.
Javascript Console
Our browsers have a javascript console we can right-click on the browser (some browsers have different elements you can easily find the way on google)and inspect later open our console which gives us the ability to write javascript codes.
Then it pops us DevTools. After clicking the console above we can reach our JavaScript console.
On console we can write our code, debug it and run it. Our code will be compiled by the JIT compiler which is in the javascript engine, then the computer runs ones and zeros.
Data types - Defining variables and constants
We can define strings with “ ” or ‘ ’, can escape from unwanted symbols with \ , we have boolean, numbers, floats,
When creating a variable we write,
var day = ‘Hello’;
we can’t use numbers while defining.
Here we can see it.
Some programming languages can not give the changing the data type after defining it. But in javascript, we can change the data type.
While we can change the variables as we want during our coding time, if we define constants we can’t change them.