What is JavaScript?

SAJID
3 min readMay 5, 2021

Ever heard about programming language? Maybe yes.
What do you know about programming language? Is it only build with ‘0’ and ‘1’ ?

Actually yes ! Programming language is build with ‘0’ and ‘1’. Then,
=> Why this programming language looks like human language?
=> How it processed and work with 0 and 1 ?

Why it is not 0 and 1 ?

Can your read the text inside the image?
Yes! You can. But I already said programming language build with 0 and 1.

Actually this programming language is evaluated from machine language which is consist with 0 and 1. After so many years of experiment and hard work, human finally make this 0 and 1 to human readable language, so that we can easily understand what this is about.

Ok. Enough chitchat! Basically JavaScript is build for browser which is only used in there. After taking chrome v8 engine outside of chrome browser as Node.js, this programming language is useful to us. Now we can use this language for backend development also. Read about Backend and Front End Development

Introduction with JavaScript

JavaScript is a programming language which is used for applying complex feature in web pages. [This is simplified definition you need to know right now]
If we compare web pages with human body, we can say that, HTML is structure of web page, CSS is it’s skin and JavaScript is it’s muscles.

So, now you can imagine that how powerful JavaScript is for websites.
Let’s know basic things about JavaScript:

indexOf()
A method of JavaScript which return the value of index in an array which is passed as parameter in this method.
Example :

const exampleArray = [“One”, “Two”, “Three”, “Four”, “Five”];
console.log(exampleArray.indexOf(“Two”);

//the output will be ‘1’

replace()
This method is used for replace anything in expected output. As example:

const dummyText = “I want to learn Python programming language and became a boss”;
console.log(dummyText.replace(“Python”, “JavaScript”));

substr()
This substr() method is used to return a portion of a string. Where, start and end index of portion is passed through the method and it returns the substring.

const stringText = “He wants to study in MIT”;
console.log(stringText.substr(0,7));

This will show this : “He wants”.

concat()
If we want to merge two or more array into one single array, we can easily do this by using concat() method. It will merge two or more array and will return a new array.

const number1 = [1,2,3,4];
const number2 = [5,6,7,8];
const numbers = number1.concat(nubmer2);

output : [1,2,3,4,5,6,7,8]

toLowerCase()
It returns a string with all lowercase in the given string.

const text = “Hello World How Are You?”
console.log(text.toLowerCase());
//Output : “hello world how are you?”

toUpperCase()
This method will return the string with all upper case. As example:

const textAgain = “hello, How Are You?”;
console.log(textAgain.toUpperCase());
//Output: “HELLO, HOW ARE YOU?”

trim()
this JavaScript method is used for remove unnecessary white space in a string. If you put whitespace before or after a string many times, then you can use this method to remove whitespace. Example:

const trimMethod = “ Testing “;
console.log(trimeMethod.trim());

trimStart()
This method removes whitespaces like previous method, but it only removes before string.

const trimstartString = “ asdfasdf”;
console.log(trimstartString.trimStart());

trimEnd()
This method removes whitespace from the end of the string. As example:

const trim = “sldfkj “
console.log(trim.trimEnd());

Math.round()
Sometimes you need rounded number for your easy calculation. This method will return a round number of fractional number. Examples:

const x = 0.6;
console.log(Math.round(x))

--

--