10 things we need to know after completing JavaScript Basic

Annoydey
2 min readNov 3, 2020

1. Primitive Values — We know that variable store primitive and reference values. Undefined, null, Boolean, number, string and symbol these are all primitive type data. If you put this data directly in side console.log then you will get direct output. For example :

console.log(45); //output 45
console.log(“Hello World”); //output Hello World
console.log(undefined); //output undefined

2. Objects and Function — Objects and functions are non primitive and it is mutable. This non primitive data type always refer to objects and it is not defined by programming language. Like : Strings, Arrays, Class etc. For example:

console.log({}); //output {}
console.log([]); //output []

3. Expressions — Simply a code which express a value known as Expressions. Expressions are just like a question which will answer by programming language. For example:

console.log(4+4); // output 8

You can also check the data type by using “typeof()” expression. For example :

console.log(typeof(12)); // output “number”console.log(typeof(“hello world”)); // output “string”

4. Coding Style — Code should be properly indented with Curly Braces and looks clean. Moreover, Your code line should be small, not like long horizontal line and we have to know where we needed Curly Braces, shouldn’t use unnecessary Curly Braces. Remember don’t forget to put semicolons. For example:

Syntex : function add(a , b) {
sum = a + b;
return sum;
}
add(4 , 5);

5. Caching — It is a concept which will give us efficiency through data availability. If the user request for data when calling similar function that time we can avoid a lot of extra data generation and can optimized the workflow also reduce time.

6. Var Declaration and Hosting — If var are treated as they are top of the function if in any case where the actual declaration occurs, this is call hosting. For example :

function getValue(condition){
if (condition) {
var x = “red”;
return x;
}
else {
return null; // here x is undefined
}
// here x is undefined
}

7. try …. catch…. finally — “try” is used for testing block of code for errors , “catch” is used for handle the error and “finally” is used to create custom error by programmer. For example :

try {
// here code block are checking
}
catch(error) {
// if we get any error it will send try to catch and handle the error also
}
finally() {
// This part of code is executed anyway
}

8. Cross Browser Testing — The practice of making sure that website created by developer it will work across an acceptable number of browsers.

9. IIFE — IIFE means Immediately Invoked Function and it’s runs when it is defined. For example :

(function ()
let add = 5 + 5
console.log(add)
)();

10. Spread Operator — It is used for adding items to an arrays and combined arrays or objects. In addition it will spreading out of an array into function arguments.

--

--

Annoydey
0 Followers

Web Developer and Programmer