“Javascript” as a Newbie view

adnan sarkar06
4 min readMay 5, 2021

--

History

1995 “Brendan Eich” create today’s JAVASCRIPT Language. After 1 year, it realise with the company name “Netscape 2” & It was called at that time “LiveScript”. After a few month’s letters, Netscape submits LiveScript to the Ecma-Internationa company. From then until now JavaScript change frequently and published almost 10+ versions. Among them 2 versions are too much popular to us is ES5 & ES6(EcmaScript 2015).

Basics

There are main 2 types of Data type in JavaScript:
1. Primitive Data Type,
2. Non-Primitive Data Type.

  1. Primitive Data Type:
    *
    String,
    *
    Number,
    *
    Boolean,
    *
    undefined,
    *
    Null
    * Symbol (new in es6)
  2. Non-Primitive Data Type:
    *
    Array,
    * Object,
    *
    Function

Today, I will discuss some of them.

Number

In JavaScript, we need to write some row text for our programming. JavaScript has a solution it, & give us a Data type called “String”. String is a same thing as a text/word/special-charecter just it’s called in JavaScript in String.

In program we need to write strings with some rules and sytex, such as every string has start with (“) and end with (”), single/double quotes you can use one of them.

Use of ‘’ & “”

There is another option in JavaScript to write string using backtick (` `) & it’s called “Template literals”. you can write it like:

use of backtick (` `)

String has some methods to help our program effective and easy. Method is like a function but it define in a object. let’s go to know some String methods in bellow:

  1. charAt()

if we provide any index number of charecter in charAt(), then it will return to us that “charecter” which belongs to the string index. look at the example:

2. toUpperCase()/toLowerCase()

Comparing one strings to another we had face some case-sensitive issue in JavaScript. Avoid this problem we can use to UpperCase()/toLowerCase() method, because if two string has same text like HELLO = HELLO, then it’s become true otherwise false. Lokk this example:

3. concat()

Somethime you need to concat two different strings in one string, then concate() method work exactly same:

4. trim()

You get some text with Unnecessary white space in string, you can’t remove those by hand then trim() method is so helpfull in this situation:

the last one I want to discuss about is not a method, it’s a property called “length”. It’s pretty usefull to know about string length or how many charecters have. Example:

This is a property and it has no () like methods.

Number

In JavaScript there is only one Data type Number it has integer, float, decimal etc. in one.
123 === 123.0 in JavaScript they are same.

Lets talk about some number methods in JavaScript:

  1. isNaN()

To check the number is a number or not, some tyme you can get something like undefined, null, string then you can check the variable is it number or not. Look like be carefull before to get error. isNAN returns true or false,

2. parseInt()

To convert any floating number to integer you can use pareseInt() method.

3. parseFloat()

To convert any integer number to float numer you can use pareseFloat() method.

4. isInteger()

To check a number is integer or not, if the number is integer then this method return true otherwise false.

5. isFinite()

Same as isInteger() method just this is to check the number infinity or not.

Array

Array is a list/collection of data. In variable you can store one data, some situation you need to stroe more than one data then array solve this problem.
you can called an array using [].

Let discuss about some array method:

  1. push()
  2. pop()
  3. shift()
  4. unShift()
  5. indexOf()
  6. splice()
  7. join()
  8. slice()
  9. replace()
  10. filter()
  11. find()
  12. forEach()
  13. map()
  14. reduce()

this methods are use to manipulate your arrays.

❤ Thank You ❤

--

--