10 most important topic for JavaScript Engineers

Anik Khan
4 min readNov 3, 2020

--

JavaScript is the most powerful and flexible programming languages of the web. It powers the dynamic behavior on most websites.

#ARROW FUNCTION

Arrow Function is an alternative from normal traditional functions. In Arrow Function is not suitable for bind, call and apply methods. It is not used as constructors. It doesn’t have any arguments. It is very easy to use for real life coding expression.

Code example : const materials = [
‘Anik’,
‘Ashik’,
‘Akram’,
‘Jakir’
];

console.log(materials.map(material => material.length));
// expected output: Array [4, 5, 5, 5]

In this code => symbol define us that its an arrow function And using this arrow function we find the length of the names.

#SPREAD OPERATOR

The spread operator is useful and quick syntax for adding items to arrays. It is combining arrays or objects . Using (…) 3dots syntax we can easily find the previous value of any array or objects.

Code example: function sum(A, B, C) {
return A+ B+ C;
}

const numbers = [1, 2, 3];

console.log(sum(…numbers));
// expected output: 6

In the above code we use (…) spread operator for find the summation of a sum function.

#DEFAULT PARAMETER VALUES

Default Parameter value is a very easy concept for learning. If we have a normal function then that function should have one or more parameter for sending into the function body. If there is multiple parameter into a function and one of the parameter has pre declared then the its called default parameter values into the function. If we did not put any number the output result will be not a number (NaN).

Code example:

1.function multiply(x, y= 1) {
return x* y;
}

console.log(multiply(5));
// expected output: 5

2.function multiply(x, y) {
return x* y;
}

multiply(5);
// expected output: NaN

#ANONYMOUS FUNCTION

This function is very easy to learn for new programmers. In this function we can give parameter or rest parameter (by … spread operator) and if we want then we will not give any parameter but the function will give some result to us .

Code example:

  1. var myFun = (…x){

return x ;

}

console.log(myFun(1,2,3));

//expected output : [1, 2, 3]

2. var myFun = ( ){

return (“Hello World”);

}

console.log(myFun ( ));

//expected output : Hello World

#BLOCK LEVEL FUNCTIONS

In this section we will talk about a code for better understanding of this topic

Code example:

alert(function(){

‘use strict’;

function f(){

return 1;

}

{

function f() { return 2;

}

}

return f() === 1;

}());

it means that function hoisting behaves the same way as let (vs var). In ES5, braces were decoration unless they appeared after a few keywords like for if try. So, the 2nd f( ) would clobber the 1st but in ES6 compat runtimes the 2nd f( ) is private to the block and thus doesn't replace the name f defined by the 1st function. In ES6 braces ( { … } ) mean a block, even without a preceding keyword. That said, i don't see many arbitrary blocks in ES6 code, maybe just from lack of practice ignorance or perhaps just from lack of need function scope works pretty well in JS.

#CODING STYLE

As a beginner programmer everyone should have learn and get knowledge about how to write code properly .Now in this section we are going to discuss about that. If we write a function then we should be careful about give spacing between parameters. We have to give curly brackets for whole function. We have to give indentation 2 spaces. If we use for loop under a function we should be careful about spacing each of element under the for loop. If use use multiple brackets in one then we have to give spaces between then. More over spacing is very import thing about any code writing.

#TRY CATCH

Try Catch is very import for every programmer to understand because as a programmer when we write a code the code will get any error but it is very frustrating for a programmer to see their whole code died. By using try and catch method we can find exact error where it occur . And our program will tell us about bugs but code will not died for the coding error.

Code example:

try {

alert(‘Start of try runs’); // (1) ←

// …no errors here

alert(‘End of try runs’); // (2) ←

}

catch(err) {

alert(‘Catch is ignored, because there are no errors’); // (3)

}

Int his try was trying to find any error but it did not find any error if it found error it will give notifications to us. But code will not died.

#PRIMITIVE VALUES

Primitive is a data it. It is not an object and it has no methods. Primitive has six types of data type . Data types are, string, integer number, bigint, boolean, undefined, and symbol. String data is a collection of words which represent a sentence. Integer number data type is basically a full number with out any float. Boolean data type is like true or false. When any programmer unintensionally make a mistake on a code then out put occur undefined. Symbols used to hide implementation details. BigInts​ used for math on big numbers.

#OBJECT AND FUNCTIONS

Object used to group related data and code. Function used to refer to ca]ode. It’s also called values but it’s not primitive . Every programmer manipulate object and functions from their own code. That’s mean they can connect to other values. A function can do smart things which is convert every work like a small thing.

#EXPRESSIONS

Expression is very easy thing that JavaScript can answer very well . Expression is nothing but work of a value. If we add integer numbers like 2+2 this is called expression. When we get result of the expression 2+2 = 4 then 4 also an expression.

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

--

--

Anik Khan
Anik Khan

No responses yet

Write a response