Javascript concepts

Abdullah Al Noman
3 min readMay 6, 2021

1.) Checking a Type

All variables in the javascript look like same. But if we can see closely, we can see something different. If we would like to see value types we can ask the type of operators then javascript returns you an answer.

Few examples we can try in the browser console:

console.log(typeof(13));                // “number”
console.log(typeof(“javascript”)); // “string”
console.log(typeof(undefined)); // “undefined”

If we would like to know the type of another example below:

console.log(typeof({}));           // "object"
console.log(typeof([])); // "object"
console.log(typeof(a => a*8)); // "function"

2)Type of Values:

If we want to work with javascript we might have to know about every type of value of javascript.

The Primitive Values of javascript :

# Null​ (invalid), utilized for deliberately missing qualities.
t tasks.
# Strings​ (“hi”, “noman”, and others), utilized for text.
# Numbers​ (10,20,4.55), utilized for math estimations.
# Booleans​ (valid and bogus), utilized for intelligent
# BigInts​ (exceptional and new), utilized for math on large numbers.
# Undefined​ (indistinct), utilized for inadvertently missing qualities.
# Symbols​ (unprecedented), used to shroud execution subtleties.

3)ES6

3)The Spread Operator

The spread operator needed when all elements we need to include from object or array.

Example :

const numbers1 = [1, 2, 3];
const numbers2 = [4, 5, 6];
const numbers3 =[...numbers1,...numbers2]
console.log(numbers3);// output: 1,2,3,4,5,6

4)Arrow Function

Arrow function something different from traditional function. It’s easier then traditional function:

Example:

const fruits= [
'Apple',
'Orange',
'Banna',
'Pinaple'
];
console.log(fruits.map(fruit=> fruit.length));
//Output [5,6,5,7];

5) Var Declarations and Hoisting

Variable presentations utilizing var are treated as though they are at the highest point of the capacity (or worldwide extension, whenever pronounced outside of a capacity) paying little mind to where the real affirmation happens; this is called raising. For an exhibit of what raising does, think about the accompanying capacity definition:

6)Block-Level Declarations

The square assertion is regularly called compound proclamation in different dialects. It permits you to utilize numerous explanations where JavaScript anticipates just a single proclamation. Joining proclamations into blocks is a typical practice in JavaScript. The contrary conduct is conceivable utilizing a vacant assertion, where you give no assertion, albeit one is required.

7)Block Building Loop

Block-level variable statements by presenting the new ‘let’ and ‘const’ identifiers. You may likewise see block scopes additionally alluded to as ‘lexical scopes’.These block-level degrees can be made either within a capacity or within any code block, for example, with an if-else explanation or for circle.

8)Global Block Bindings

The variable is all the more officially known as restricting. At the point when we announce or potentially instate a variable, we really tie a worth to a name inside an extension. Extension normally alludes to a particular piece of a program.

Coding Style

Our code must be clear and readable so that it’s everyone can read it. It will be human-readable.

9)Curly Braces

In most JavaScript projects wavy supports are written in “Egyptian” style with the initial support on a similar line as the relating catchphrase — not on another line. There ought to likewise be a space before the initial section, this way:

if (condition) {  do this}

10)Style Guides

A style direct contains general standards about “how to state” code, for example, which statements to utilize, the number of spaces to indent, the maximal line length, and so on A ton of minor things.

At the point when all individuals from a group utilize a similar style direct, the code looks consistent, paying little mind to which colleague composed it.

Obviously, a group can generally compose their own style control, yet as a rule, there’s no compelling reason to. There are many existing advisers for look over.

--

--

Abdullah Al Noman

I am a curious front end developer. Everyday I learn and I would like to learn more and more.