Level up your JavaScript Knowledge.

  1. JavaScripts Primitive Values.

Primitive Values​ are numbers and strings, which can be have something in commons. Objects and Functions are also values, but you can't call them primitive values. This actually makes them very special. You can console log below codes and see the differences:

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

2. JavaScript Event Loop.

Actually, how does JavaScript Works? Yes when we started learning JavaScript, every curious developer want to know this after a while. So JavaScript event loop has a concurrency model, which is responsible for executing the code, collecting and processing events, and executing queued sub-tasks.

3. JavaScript Try Catch

Error is part of our programming life. There is not a single day when we try to code and not get an error. But there's a solution called try…catch construct that allows us to ‘catch’ errors without dying the script for doing something more reasonable.

try {
// code...
} catch (err) {
// error handling

4. ES6 Block Bindings

In C-based Languages Block Bindings or Variables are created at the spot where the declaration needed. But In JavaScript variables are only created depends on how you declare them. ECMAScript 6 (ES6) offers options to make it easier to control scope.

5. Var Declarations and Hoisting

Var declaration using var are treated as if they are at top of the global scope, for a demonstration of what hoisting does, consider the following function definition:

const getvalue = () => {

if (condition) {
var value = "blue";

// other code

return value;
} else {

// value exists here with a value of undefined

return null;

// value exists here with a value of undefined

6. Block-Level Declarations

Whenever we tried to declare variables that are inaccessible outside of a given block scope that is called Block-level declarations. Block scopes are created:

  1. Inside of a function
  2. Inside of a block (indicated by the third bracket)

And the intention of ES6 is to bring that same flexibility to JavaScript.

7. Block Binding in Loops

I learned so many topics today by exploring Block Level Scoping. There is one of the interesting topics is Block Binding in Loops. Developers mostly want block level scoping of variables is within for loops, where the throwaway counter variable is meant to be used only inside the loop. For Instance, it's not uncommon to see code like this in JavaScript:

for (var i=0; i < 10; i++) {

// i is still accessible here
console.log(i); // 10

8. Functions with Default Parameter Values

Today I also learn some advanced technics about functions as well. Functions in JavaScript are unique because they allow any number of parameters to be passed, regardless of the number of parameters declared in the function definition.

9. Working with Unnamed Parameters

Another Important thing is Function can working with unnamed parameters. That means JavaScript functions don’t have any limit for the number of parameters that can be passed to the number of named parameters defined.

10. The Spread Operator

Last, not least JavaScript spread operator is a new addition to the set of operators in JavaScript ES6. Here’s a simple use case for this method:

let value1 = 25,
value2 = 50;

console.log(Math.max(value1, value2));

Also closely related to the rest parameters is the spread operators. While rest parameters allow you to specify that multiple independent arguments should be combined into an array.

So that’s all for today. I hope these JavaScript advanced topics will help you to learn more about JavaScript.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store