Here’s What No One Tells You About JavaScript Developer Path…(part-1)

Shubham Baghel
3 min readNov 14, 2021

Before going to the Developer path in JavaScript every future developer should acquire these concepts like Objects, Class, ES6. Below are some core concepts which we are going to learn from scratch.

  1. Objects
    In JavaScript, an object is a collection of key-value pairs. Each key-value pair is called a property also object is a standalone entity, with properties and type. In JavaScript, key of a property can be a string values and the value of a property can be JavaScript value which can be string value, a number value or an array, and even a function.

A different way to create Objects:
In JavaScript, there are different way to create an object as shown below:

a. Object Literals.
b. New operator or constructor.
c. Object. create method.
d. Class

i.Object Literals:
Object Literals are a more convenient way to define objects.we need to simply define the property and values inside the brackets as shown below:

ii. New operator or constructor.
Another way to create an object is to use the constructor function. Here we are calling a function using a new operator, the function will act as a constructor and returns a new object.

Using New operator

iii. Object.create method
The third way where we can also create new objects using the Object.create() method

Using Object.create() method

iv. Class
ES6 is a new standardized version of JavaScript that was released in 2015. ES6 has many new features that can help a developer to understand and write code efficiently and effectively. The “Class” is the keyword which we can used to create classes easily in JavaScript . Now we can use the class attribute to create a class in JavaScript rather than other ways like function constructor, and we can utilize the “new” operator to create an instance of that class with ease.

Using “new” keyword

Here you can see we have a Blog class in which we have getblogDetails() method which we will be calling on after creating an instance of the Blog class. This is the best way to create objects in JavaScript and is used in many JavaScript patterns.

2. Functions in JavaScript
Functions are the most crucial part of JavaScript programming. Functions are a set of statements that are used to perform a certain task. Function will provides us a easy manner to define and structure programs, reduces code redundancy and increase usability ,maintain separation with respective code modularity.

-Defining a function
function definition tells about a function’s name, return type, and parameters. A function definition will tell us the actual body of the function.

In JavaScript function is created using the keyword “function” suffix with function_name. Functions have a set of parameters and a body, which includes the instruction or operations that are to be executed when the function is called inside the program. In this code snippet, generateRandomValue() is a function that will generate a new value when it is called.

..…to be continued

--

--