Rifa Tasfia
4 min readNov 2, 2020

--

Dive into JavaScript

JavaScript was created in 1995 by Brendan Eich. It is a multi-paradigm, dynamic language. It is designed to run as a scripting language in a host environment. The most common host environment is the browser, but JavaScript interpreters can also be found in a huge list of other places, including Adobe Acrobat, Adobe Photoshop, SVG images, Yahoo's Widget engine, Node.js, embedded computers, and others.

Object Oriented Language? Yes or not

JavaScript is object-oriented, but is not a class-based object-oriented language. It supports inheritance through prototyping as well as properties and methods. So it can also be said prototype-based language.

Var vs Let vs Const

Var declarations are globally, or locally, or function scoped. Var declaration can be updated and re-declared within its scope.

Let declarations are Block scoped. The declared variable is available from the block it is enclosed in. Let variable can be updated but not re-declared.

Const declarations are Block scoped. Const allows to declare variable whose values are never intended to change.

Operators

  1. Numeric Operators: +, -, *, /, % (remainder/modulo) these are numeric operators.
  2. Relational Operators: >, < , ≥, ≤, ==, ===, !=, !== these are relational operators.
  3. Boolean Operators: && (logical and), || (logical or), ! (logical not) are boolean operators.

== vs ===

== compares only values not data type.

Example:

Output:

But === compares both values and data type.

Example:

Output:

Data types

1. Numbers

2. String

3. Boolean

4. Object (Function, Array, Data, RegExp)

5. Null

6. Undefined

Numbers

The JavaScript Number type is a double-precision 64-bit binary format IEEE 754 value

parseInt: Converts a string to an integer.

Syntax: parseInt(string, radix)

  • If a string starts with “0” the radix is 8 (octal )
  • If a string starts with “0x” the radix is 16 (hexadecimal)
  • If a string starts with any other value then the radix is 10 (decimal)

parseFloat: Converts a string to floating point number.

Syntax: parseFloat(string)

isNaN: Determines whether the passed value is NaN (Not a Number).

isFinite: Determines whether the passed value is a finite number.

String

In JavaSxript string is a sequence of unicode characters.

Some interesting string methods:

  1. charAt():

Output:

2. replace():

Output:

3. slice():

Output:

4. split():

Output:

5. include():

Output:

Boolean

It only take two values, true or false

Null

The value null represents the intentional absence of any object value. It is supposed to be something that doesn’t exist

Undefined

Undefined is an uninitialized variable. It indicates that a variable has not been assigned a value.

--

--

Rifa Tasfia
0 Followers

I am an undergraduate student of IIT, Jahangirnagar University. I am very much passionate about learning new technologies.