4 min readFrontend
Some topics in web development
As a web developer, you have to smooth the user experience by handling the error properly. By using the try and catch method, we understand where the problem is. Try and catch are…
- JavaScript

Try and catch
As a web developer, you have to smooth the user experience by handling the error properly. By using the try and catch method, we understand where the problem is. Try and catch are two blocks. Your main code will be located in the try block. First, the try block will execute; if there is any error in your main code, then the execution stops in the try block and go to the catch block. The catch block accepts an error parameter. By error parameter, you can know why is the error occurs.
Coding style
To become a good developer, your code must be as clean and easy to read. Styling your code is not rocket science. You have to make your code correct and humanly readable. To make it readable, you have to write your code in such a way that looks pleasing to anyone's eyes. How can you do it?? You can achieve that by using the right amount of Indents, Line Length, and Curly Braces. Automatically check the style of your code and make improvement suggestions. You can use Automated Linters tools such as ESlint.
Primitive and Non-Primitive
There are two data types primitive and non-primitive. String, Number, Boolean, Null, Undefined are primitive data, and Object, Array, Function are non-primitive. The primitive data type can not be changed after its creation, but the non-primitive data type can be changed after its creation.
Commenting
One of the good practices is commenting on your code. Comments guide someone on what is happening in your code. If someone reviews your code, they have to understand how some parts of the code are happening. What is this or that? Commenting on your code also good for yourself. Because after some months later, when you go back to your old code, you might not understand what is happening and what is not. So try to write a good and informative comment so that anyone can understand what is happening.
Arrow Function
An arrow function is the updated version of the function. Arrow functions are anonymous functions. You have to declare an arrow function in a variable. Arrow is introduced in ES6.
const sayMyName = ()=> {
console.log("shakib")
}Spread Operator
Another es6 feature in the spread operator. .concat() The method can concatenation a value at a time. What if you need to concatenation multiple arrays at one time. For this situation, you have to use a spread operator.
const a = [3,4,7,9];
const b = [1,6,9,0];
const c = [...a,...b];
console.log(c); // the output will be [3,4,7,9,1,6,9,0]Block Binding and Hoisting
In javascript, every scope has been created by code blocks. When we declare a Let or Const variable in scope, it is hoisted to the top. We can change and modify it from this scope. Var is hoisted to the global scope, so we can access a var variable from anywhere in the code. When we use var variable to loop, it can change other variable values if that contains the same name. So it is to use let and const for variable declaration.
Expression
Javascript is also used to give a question’s answer in its way. That is called expression. For example — console.log(2+2). Expiration gives you a single answer or a single value. In this case, the answer is 4.
Default Parameters
In es6, you can set a default value for your parameter if the parameter didn’t get the value when the function called. Then the default value will be used.
function sum (a,b = 2) {
return console.log(a+b);
}
sum(3); //the output is 5.Cross-browser testing
Cross-browser is a system to check your website, which you created as a web developer, is working properly on any devices or in browsers. One of the most important responsibilities is to ensure that website is okay from several devices and browsers.
That is all for now. See you later.
Be Happy. : )
Originally published on Medium (opens in a new tab).