DEV Community

Avishek Talukder
Avishek Talukder

Posted on

JavaScript Part 2

Cross Browser Testing

Cross Browser Testing is a way to check your website or apps should work in all kind of browsers & environments, even for challenged people who are using that thing very difficult. If you are a developer, you have to think about a certain limit of browsers and users while building your product. Usually, a cross-browser issue occurs, when the developer uses a high animation graphic for looking good on pc, but it doesn't fit on mobile. another reason for that is continuously updating the browser feature because of the competition of companies. The Browser testing process is quite simple. the first developer takes an initial step, then he develops the product. After that, he tests the product again and again to discover the bugs, then he fixes that. That is the process of Cross Browser Testing.

JavaScript Data Types:

There are mainly 2 types of JS Values, One kind is Primitive Values & another kind is Objects & Functions. Again Primitive values have 7 types, such as null, undefined, Booleans, numbers, strings, symbols, BigInts.
There are no other types in JS. Even arrays, dates & regular expressions are objects in JavaScript. We can check mathematical functions by using expressions in JS.

Try...Catch Syntax

Sometimes we got errors when we code. This is where try....catch syntax come. if we code inside the try syntax and try to build it when we face errors, the build process stops & the catch syntax finds the error & show it in the console. But, for that, the code has to be runnable. if the code has a syntax error, then this function will not run.

Codding Style

When a developer code in JS, his code should be clean and readable, that anyone who has a decent knowledge of JS, should understand the code. For that, there is a coding style. There is no obvious thing in the coding style. If we give an example here, curly braces should take a gap after the function is called. Try to take indentation between the codes for clear understanding. Try to avoid deep nesting, after one or two-level, the coder should not do any more nesting.

Comments

This happens often, that after a certain time if we look back into our code, we might not understand the structure at first. That is where the comments come. Comments are essential to understand the code structure properly. Comments should not give so that anyone understands what's going on to the function, but understands the code structure and what's going on in the project. It also helps to understand which function is using for what purpose.

Block Bindings

Block Bindings is always been a tricky part of Programming. In C languages, where the declaration occurs, the variables are created there. But in JS, the creation of variables depends on how the developer declare them.

Var Declarations and hoisting

When variable declarations using var are treated as they are top of the function regardless of the actual declaration occurs, that is called hoisting. At first, many developers don't understand the concept of declaration hoisting, as a result, they end up creating bugs. but as time flows, they can catch the concept.

Functions with default parameter values

There are many times when parameter are not provided in the function, then the default parameter works in the function. The concept of default parameter values allows working with a different kind of parameter in the function.

Spread Operator

the spread operator is one kind of rest parameter, somehow closely related. This operator allows to specify an array and then split it then pass it through separate arguments to the function.

Arrow Functions

Arrow functions are one of the interesting parts of JS. There is no prototype in the arrow function. Everyone must rely on the named and rest parameters since there are no arguments bindings.

Top comments (0)