Javascript ES6 Related Fundamental Concepts

Programmer Naim
3 min readMay 6, 2021

Hello programmers,

Today I explain the javascript fundamental concepts. Javascript is a single-threaded scripting programming language. It was released in 1995. Nowadays ES6 version continues in javascript. Let’s start to explain javascript ES6.

1. Constant Variable

the constant variable is used to declare a variable. You can’t replace or change any variables value If it has already declared a value. You get an error if you try it. If you do not believe let’s do it.

const text = ‘javascript’

text = ‘javascript ES6’

console.log(text); // You will get this output : TypeError: Assignment to constant variable.

2. Let Variable

let variable is used to declare a variable. You can replace or change any variable value if it has declared a value. When you change data in a variable then you use let. How do you use it? let’s see.

let text = ‘javascript’

text = ‘javascript ES6’

console.log(text); // Output is: javascript ES6

3. Block Bindings

Block binding is used by var keywords. It is a traditional and tricky keyword for declaring a variable. You can use it the way you want. let’s see how it declares.

var text = ‘javascript’

text = ‘javascript ES6’

console.log(text); // Output: javascript ES6

4. ForEach

ForEach is an ES6 loop function. You can use it to get an item from an array. It is an advanced loop method in javascript. let’s see how to use it.

const arr = [‘java’, ‘javascript’, ‘python’]

arr.forEach(item => {

console.log(item); // Output is : java javascript python

})

5. Array Function

array function is an advanced function declare system in javascript. It is a shortcut uses in javascript. You can parse an argument in the array function. let’s see how to declare an array function.

const declareArrayFunction = () => {

return ‘javascript’

}

const result = declareArrayFunction()

console.log(result); // Output is : javascript

6. Function Deafualt parametares

The default parameter is used to give a default value in parameters when you use a function. If you don't take parameter value from the user then you set the default value in parameters. let’s see how to declare the default parameters value.

function deafualtParametares (a, b = 2) {

return sum = a * b;

}

const result = deafualtParametares(4)

console.log(result); // Output is: 8

7. map

the map is a javascript ES6 method. It is similar to forEach. If you want to get an item from an array you can use the map method in javascript. So, let’s see how to use it.

const arr = [‘red’, ‘blue’, ‘green’, ‘orange’]

arr.map(item => console.log(item)) // red blue green orange

8. Filter

The filter is an ES6 method in javascript. If you want to remove an item from an array or filter an item from an array then you can use the filter method. Let’s see how to use it.

const arr = [‘mango’,’banana’, ‘apple’,’orange’]

const result = arr.filter(item => item === ‘banana’)

console.log(result); // Output is: [‘banana’]

9. pop

The pop method is used to delete an item from an array. It deletes an item from the last item in an array. If you want to remove an item then use the pop method. let’s see how to use it.

const arr = [‘javascript’, ‘java’, ‘python’, ‘php’]

arr.pop();

console.log(arr); // The output is: [ ‘javascript’, ‘java’, ‘python’ ]

10. push

The push method uses to add an item or element to an array. It adds from last sight an array. If you want to use this method on your website then let’s see how I do.

const arr = [‘mango’,’orange’,’lichi’]

arr.push(‘jackfruit’)

console.log(arr); // the output is: [ ‘mango’, ‘orange’, ‘lichi’, ‘jackfruit’ ]

--

--