Introduction
What is JavaScript?
JavaScript is an object-oriented scripting language used to make webpage interactive.
You must be thinking ๐ค about what object-oriented or scripting means. okay so let's understand โจ
Object-oriented programming: It is a programming paradigm ( an approach to solve a problem with the help of some programming languages ) based on the concept of "objects", which can contain data and code: data in the form of fields ( as attributes or properties), and code, in the form of procedures ( as methods).
Scripting Language is basically a language where instructions are written for a run-time environment. They are usually interpreted at run time rather the compiled.
History of javaScript
Before 1995, web pages could only be static, it lacks the capability for dynamic behaviour often the pages were loaded in the browser. There was a demand in the fast-growing web development field to remove these limitations. So in 1995 Brenda Eich
was hired to come up with a new language with syntax similar to java. The new language and interpreted implementation were called LiveScript but shortly changed to JavaScript in December 1995.
Many of you might be thinking why it is called "JavaScript" when it is not at all similar to Java
I also thought the same when heard for the first time. The reason is simple that Java was the hot new programming language at that time and they thought it would create a good impact on the newly invented language.
Now Let's dive into the topic .
Datatypes
Datatype is a category of data representing in distinct way to differentiate between each other. It is divided into two :
- Primitive datatype :
It includes
- Numbers ( Integers , Floats )
- Strings ( Any data under single quote , double quote , or backtick quote )
- Booleans ( True or False value )
- Null ( Empty or no value )
- Undefined ( A declared variable without a value )
Non-primitive datatype : It includes
- Objects
- Functions
- Arrays
Let's Understand with the help of examples
Examples of primitive datatype
var length = 16; // number
var firstName = "Aditi"; // string
console.log( 4> 2 ); // boolean
var x = null;
x; // null
var num ; // undefined
Examples of non-primitive datatype
let obj1 = { // object
name:'Aditi',
role:'Student',
country:'India'
}
function a(){ // function
}
var arr = [ 1 , 2 , 3 , 4 , 5 ]; // array
Time For The Test : check the data type of a certain variable
let firstName = 'Sumit';
let lastName = 'Kumar';
let country = 'India';
let city = 'Patna';
let age = 20;
let job;
Congratulations ๐๐You Have Started Your Journey with one of the most demanding languages JavaScript.
Here are some resources which you can follow
- codedamn.com/learn/javascript-basics
- w3schools.com/js/default.asp
- developer.mozilla.org/en-US/docs/Web/JavaSc..
- javascript.info
This is my first blog so there may be something which you may like or you may not so please write it down in the comment. It'll Sure be going to help me in improving. Thank You