JavaScript Fundamental Concepts

Abdur Rahman
2 min readNov 4, 2020

JavaScript Some Topics

1. Comments:

A comment is a common part of javascript. Comments can start single line // and multiline /* …. */. Comments use why you create a function or another.

For example:

/* You can see bellow single line comments

and it is multiline comments*/

const name = “Abdur Rahman”;

console.log(name);

// expected output: “Abdur Rahman”

2. Coding Style:

The coding style is very important in javascript. javascript code must be as clean and easy to read as possible.

Coding Style Details

3. Error Handling:

Error handling is a common topic in javascript. It uses try…catch…finally. input your code in try curly brackets. if your code error then inputs catch method otherwise ignore this method. catch method show an error message. the last method is finally method. this method is executed always.

For example:

try {

alert( ‘try’ );

if (confirm(‘Make an error?’)) BAD_CODE();

} catch (e) {

alert( ‘catch’ );

} finally {

alert( ‘finally’ );

}

4. Primitive Values:

Primitive Values are number, string, undefined, null, and boolean.

For example:

console.log(10); // number

console.log(“Abdur Rahman”); // string

console.log(undefined); // undefined

console.log(null); // null

console.log(true); // boolean

5. Objects and Functions:

Objects and Functions are special values in javascript. It is not Primitive Values.

For example:

console.log({}); // Objects

console.log([]); // Objects

console.log(x => x * 2); // Functions

6. Cross-browser Testing:

As a Web Developer know that Cross-browser Testing. Developer tests a website functionality different browser. A developer can not use the old format. Sometimes developer checks this website because the browser always update. A developer can bug problem fixing.

7. Functions with Default Parameter Values:

You can set default parameter values in the function. if you do not pass the parameter values, it’s value input default values.

For example:

function plus(a, b = 10) {
return a + b;
}

console.log(plus(3, 2));
// expected output: 5

console.log(plus(5));
// expected output: 15

8. Spread Operator:

Spread Operator uses two array concatenate. It is output one array value with another array value.

For example:

let nub1= [1,6,3];

let nub2 = [4,5,8];

nub= […nub1,…nub2];

console.log(nub); // [ 1, 6, 3, 4, 5, 8 ]

9. Arrow Functions:

Arrow Functions are alternative Semple Functions. It is ES6 javascript. Arrow functions are good looking.

For example:

const name= [
‘Rahim’,
‘Karim’,
‘Rahman’,
‘Rayhan’
];

console.log(name.map(name=> name.length));
// expected output: Array [5, 5, 6, 6]

10. Global Block Bindings:

var is a global variable. You can declare var values in a global object like a widow in the browser. this character different between var and let or const.

For example:

var name = “‘Abdur Rahma”;

console.log(window.name);

// expected output: “Abdur Rahman”

--

--