Basic Knowledge About Javascript

Basic Knowledge

Hello, my programmer's friends!!

Today I will describe to you some basic knowledge about javascript. Are you ready …!!

Let's start now!

Types of values in Javascript: Friends!!
Are you see the sky!! If you see the sky then you see many stars in the sky.!! Sure!?

So my friends…. Imagine Javascript is like the sky. In this sky many stars which are called“values”. Are you confused !! No No … I say details ….

I hope that you see many values in Javascript. But you should know here many types in this values. If you console these then you will understand something…

Details in types:

The type of values is 9:

Undefined: This type of value you show when you use unintentionally missing values.

Null: This type of value you show when you intentionally missing values.

Booleans​: This type when you store your value or see by true or false, and used for logical operations.

Numbers​: This type when your value is number.

Strings​: This type you see when your value is a string.

Symbols​, BigInts​ These two types are uncommon.

Hello programmers… attention, please!!

These 7 types called Premative values.And two types without these which is object and function type. Like this..

Find types: You will ask me now… How you find the type of values!? SO my programmer's friend!! you use this method “typeOf()”. Like this…

Error Handling: I know you are a programmer. It doesn't matter you are a junior or senior programmer!! But When you start programming you face always many problems and errors. SO now I am discussing that “how to solve your problem very easily and efficiently way !?”

My programmer's friends when you face a problem or error then our ‘Javascript ’ Boss sends you an error message. Many times you don't understand this. So if you use the “try….catch” method for error handling then you understand your error very easily. You should know that this error message an object. Here three parts … 1.error name 2.error message 3.error stack. If you use the “try…catch” method then you can differentiate between these.

Now you want to know what is “ try…catch” method!? So look at this code…

In the “try…catch” method two blocks. Under the “try{….}” blocks you write your code and under the “catch(error){……} ” blocks you write your error handling code. If you write “” then you get your error name.

But my friends… this is works in run time errors. I mean if your code won't have any syntactical error then this method will work.

Set new error message: You are a programmer. So you want to set a new error message for your code. You do this like this code …

Here I use the “throw” operator which generates a SyntaxError by my message.

Block Bindings: Are you know my friends!! what are block bindings!?
So you should know that when we declare our variable by using var, let and const then occur Binding. Like this…

Var Declarations and Hoisting: If we are declaring our variable by using var then declare this on the top in function or global scope if declared outside the function.

But here a problem you face some time. That if you declare your function by var on the top then you access this variable from outside. Like this…

Block-Level Declarations: We show that in our variable when use var that accessible from outside the block scope. But if we declare our variable by let and cost then it's doesn't accessible from the outside block. It's fixed in a block.

Spread Operator: This is a special feature of ES6. Which do the work by javascript very easier. It's useful for many different tasks like …

  • Copying an existing array
  • Merge or combine arrays
  • Call function without apply

I am saying to you one example...

Arrow Functions: Hello my friends!! ES6 made a very easier function declaration. Which called is the “arrow function”…

So my dear programmer friends today I close my story. I am coming soon in the next story….



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Ahsan Ullah

I am a web developer. I have excellent skills in web development. Worked in HTML, CSS3, Reactjs,Nextjs, Javascript, TypeScript, Bootstrap, and MaterialUI.