Important Topics of JavaScript You Must Know :- Part-2

1. Data Types in JavaScript

JavaScript has two types of data types: Primitive Data and Non Primitive Data.

Primitive Data Type has 7types those are:-

  • Undefined
  • Null
  • Boolean
  • Numbers
  • Strings
  • Symbols
  • BigInts

Non-Primitive Data Type has 2 types those are:-

  • Object
  • Functions

But you can say non primitive data are not 2 types only one types because functions are also objects

There no Array type, no other type in javascript rather than primitive type everything is objects in javascript that’s sounds wired but that is true.

2. Primitive values in JavaScript

  • Undefined​ , when we define value but not add the value.
  • Null​ (null), when developer add intentionally null value
  • Booleans​ , whether value is true or false
  • Numbers​ (1,7,-8,8.88, and others), we used number for calculation
  • Strings​ (“hello”, “programmer”, and others), we used String for text.
  • Symbols , we hide details of code implementation
  • BigInts​ , using when do big number math.

3. Event Loop in easier Way

  • firs time when we call bar() function then it will take place on to the stack and after that when we call foo() function then it will take place above of the bar() function and in the running execution when foo() returns then it get out of the stack and after that bar() function also out of the stack and stack being clear empty as wel.

4. All about Try() Catch()

  • without learning try catching very well we cannot be a good programmer
  • because it is normal that we will write code and millions of times we have to face bugs but in case of bug fixing, how we can fix bug without knowing try catch.
  • when a bug appear in our apps. we write a try catch block and try to fix the bug but … not all them time bugs happens inside of app it can happens outside then we will write another try catch block and call that try catch block or function inside other try catch block
  • sometimes we don’t want a catch block… we want that what happens i don’t care i need to run these lines of code anyhow here comes the finally block
  • we just write try block and finally block we don’t care about the catch block the code of try block can run or not.. but the from finally block have to run must.

5. Hoisting

6. Block Scope in details

  • well let me describe that’s a another topics with hoisting and scope. that’s called block scope there is a if block and let is block scoped. Not like var it will not hoisting in the upper level and it will not available out of the scope.

7. Confusion between rest parameter and spread operator

  • We use rest parameter to pass arguments when we don’t exactly know that how many value we will get or how many value we need we will accept how many we got…
  • for iterating in a array or doing other thing when we can’t really do those things manually and easily. it is easier to use spread syntax and do lot’s of good things with it
  • We always use rest parameter as a parameter of a functions and Spread operator to use in deferent ways. to iterate array. copy one array from another , expand string etc….
  • rest parameter has only one uses on the other hand we can use spread operator for multipurpose of use.
  • Though they looks similar but they are not similar their uses are different from each other

8. Everything about default parameters

  • Default parameters are like when we declare a function we sometimes gives parameter on it or we can declare without parameter also.
  • But when we declare a function with parameter we also can declare a function with parameter
  • when we declare a function to add two value with two parameter like (num1,num2) we can also like (num1 =5 , num2 =10)
  • The advantage of default parameter is when we call the parameter and if we intentionally or accedently not passing the value.. still it will give an ans for the call . that is 5+10 =15.

9. Block level Function

  • carefully look at the code. what you can see is a function scope. scope is also same for the function as for the let and const.
  • hoisting means that they are behave like var and const and here as well every time in javascript we use braces like {} this it means a block . everything inside braces is block scoped no matter what it is a function or if block
  • block level function means inside a function another function in declare and another function can be return inside a function and it will call the function block

10. Array Function in depth

  • we don’t need binding for array function and it does not have any binding
  • in Array function there is no argument
  • as i say that it does not have any binding that’s why bind and call or apply cannot be possible with it
  • we cannot use the array function as a class component constructor

That’s it for Today see you in the next Article…. Till Then Stay Well



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
Aslam Hossain

Aslam Hossain

Currently I’m working with M E R N stack. I love to learn new technology and explore them. I’m a simply simple person with lots of interests.