Let’s know something more interesting about JavaScript's

Nishat Raihana Prantik
6 min readMay 6, 2021
  1. what is Primitive Values in JavaScript

JavaScript provides different types of value . There are two types of value in JavaScript.

  1. Primitive value
  2. Non-primitive value

Today we will know about primitive value. In JavaScript, a primitive value is data that is not an object and has no methods. There are 7 primitive data types: String, Number, Bigints, Boolean, Undefined, Symbol, and Null.

String: The string object is generally used to represent and manipulate a sequence of characters.

Number: Number is a primitive wrapper object which is used to represent and manipulate numbers like 37 or -9.25.

BigInt: BigInt is a built-in object whose constructor returns a bigInt primitive.

Boolean: Generally boolean holds two types of value one is true and another one is false.

Symbol: Symbol is a built-in object whose constructor returns a symbol primitive.

Undefined: when you have declare a variable but don’t give any give any value . after execution it will show you that the value is undefined . it’s totally unintentionally when the value is missing.

Null: when you have intentionally miss the value for the variable .

2. Event Loop in JavaScript

event loop

From this picture we can see that in a event loop four major event happened they are — call stack, browser API, event queue, event loop. in JavaScript's the call stack is responsible for keeping track of all the operations in a line which need to be execute . when a function is finished it pop up from the stack . After all the function called it send to the browser API . Based on the command received from the call stack, the API starts its own single-threaded operation. The work of the event queue is that it will be send new functions to the track for processing. It maintain queue data structure for the correct sequence in when all the operator send for execution. After finishing one execution the event loop continuously check if the stack is empty or not . if it is empty than new functions are added from the event queue .

3. Benefit of using try-catch in error handling

try-catch is very important when it comes to writing code . Whenever we write code we don’t know where we make a mistake in our code . But using try-catch , it allows us to catch errors so that the script can, instead of dying, do something more reasonable. first the code goes to try block if there is no error it will skip catch block but if the error happened than it will go to the catch block for find out the type of error.

diagram of try-catch

4. Why we need Coding-style when writing the code.

Writing the code is not everything . when writing the code you have to write in such a way that people can understand your code easily and it looks neat and clean . code should be organized .

coding-style

5. What is Caching and Data Cost

Caching :A cache is a high-speed data storage layer which stores a subset of data, so that when any requests come in future, that data can be served up faster than a possible way by accessing the data’s primary storage location. Caching allows you to reuse previous computed data.

Data Cost: If we want to say simply , Data cost is the idea that every operation, function, or any other aspect of what we do with an API results in to provide some sort of cost. This cost can rise according to various factors and systems, from both the server and client .

6. Client caching and Server caching

Client cache: It helps to reduce the data cost that the user spend by keeping locally the commonly referenced data. Sometimes the client requests some data that may not be large but that need continuously.

Server cache: It helps to reduce the data cost that the server spend and its underlying systems. Numerous request made by customers can either be reacted to utilizing a similar information, or reacted to utilizing portions of similar solicitations made by others.

7.Why we need cross browser testing

As a web developer cross browser testing is a essential part . It will help you to make sure that the web sites and web apps you create work smoothly in any kinds of web browsers. As a web developer, it is your responsibility to make sure that not only your projects work according to the command but also they work for all your users, no matter what type of browser, device, or others tools they are using. You need to think about some older browser may not work with the latest version of different framework , CSS or JavaScript. for that you should check it properly that in those browser your code running smoothly or not. even different device has different capacity , from the latest greatest tablets and smartphones, through smart TVs, right down to cheap tablets and even older feature phones that may run browsers with limited capabilities. so, the main point is that you have to test cross browser testing so that there were no issue when you deliver your project to the client.

8.Importance of testing for the code

When you will work with any project after all the phase the important phase come which is testing .Before delivery your work ,you should make sure there are no general issues with your code which will be a problem for your work. You should test your code in some daily usable and popular browser like Firefox, Safari, Chrome, or IE/Edge etc. even not only browser in laptop but also you should test in any kind of small or medium device also . you should also do some lo-fi accessibility testing, such as trying to use your site with only the keyboard, or using your site via a screen reader to see if it is navigable. than if you pass this than try to test your work in others different device also .

9.Arrow function, Default Parameter Function

Arrow function: Arrow functions allow us to write shorter function syntax. such as —

before —

hello = function() {
return “Hello World!”;
}

after —

hello = () => {
return “Hello World!”;
}

Default Parameter Function: The default parameter is a way to set default values for function parameters a value is no passed in. In a function, If a parameter is not provided, then its value becomes undefined. In this case, the default value that we specify is applied by the compiler.

10. Block level declaration , Block binding

Block level declaration: Block-level declarations are the ones that proclaim factors that are far outside of a given square degree. Block scopes are created:

  1. Inside of a function
  2. Inside of a block

Block binding: Generally ,the way we declared variable has been one tricky part of programming in JavaScript. In most C-based languages, variables are created at the spot where the declaration occurs. In JavaScript, however, this is not the case. Where your variables are really made relies upon how you proclaim them, and E6 offers alternatives to make controlling extension simpler.

--

--

Nishat Raihana Prantik
0 Followers

Hello there , hope my publishing blog will help others