A simple overview of es6, function and data types.

Towhid Hossain
4 min readNov 3, 2020

After learning about javascript core concepts, consecutively we will enter into the beauty of javascript by knowing some modern features. Among those features, today we are going to discuss es6, functions and data types related topics. So let’s get into the depth zone of javascript.

ES6: The 6th version of ECMA Script 2015 is called ES6. It contains a lot of features (let, const, arrow functions, class, promises etc.) to standardize javascript. It is built to create large-scale software, formatting codes in a clean and easier way. We will know more about its features in this article with example.

ES6
  1. Var Declarations and Hoisting: Variables declare at the top of of the function or in global scope is named hoisting. In this term variable declared before function execution.
Hoisting

2. Block-Level Declarations: Unlike ‘var’ declaration, variables of block-level declarations (let, const) could not access out of their specific block scope. This type of block scope created inside a function and Inside of a block (indicated by the {} characters).

3. Block binding in loops: var declaration can be used out of for loop, but block-level declaration only works inside the loop.

global scope
Block-level scope

Function: In javascript, a function is an object where it has a method, property like other objects. To return a value, the function should have a return statement, otherwise, it returns the default value. Parameters in function are called arguments that pass by value.

let myFunction = function() {
//statements.
}
  1. Function with default parameters: Function has a default value is undefined. If we do not pass any argument, the function will return a value of undefined.
default param

2. Block-Level Functions: Before es6, block-level functions were not allowed to use strict mode.

block-level function

3. Arrow Function: After es6, arrow function introduced to make function block statement shorter and easy to understand.

Arrow

4. Spread Operator: This operator consists of three dots[…], it is used to spread out elements of an array or an object.

spread operator

Data Types: In javascript variables, there are various data types like numbers, string, objects etc. Data types are important for computer, without these, the computer could not define the value. Now elaborating about data types.

  1. Objects and Functions: They are values, but not primitive. We can use them whenever we need them. In the browser console, primitive value displays as a string, number. But object and function display differently in the console.

2. Expressions: Sometimes, we question javascript with expression, and javascript answer it with value.

Expression

3. typeOf(): It’s an expression, we can get the type of data with this data type.

typeOf

We have covered a few things among the javascript arena. In a nutshell, we have discussed javascript data types, objects, function, block binding, es6 etc. I will come back with my learning and share with you, so that will help me to recall again and again. Break a leg.

--

--