DEV Community


10 Basic Topic For Beginner JS programmer

rahulghosh profile image Rahul Ghosh ・3 min read

1 Types of Javascript

JavaScript has data types. In the programming world, data types are an important concept. Actually, javascript differ their type in two way “Primitive Values” and “Object”

Some primitive data type is

i strings​
ii number
iii boolean
iv undefine
v null

Object are
i object
ii function

2 What we do when errors happen!!!

Sometimes when executing JavaScript code, different errors can occur. So what do we do?
Javascript have a special error handler TRY and CATCH

The ‘try’ statement checks the block of code to be tested for errors while it is being executed and if an error occurs in the try block the ‘catch’ statement catches the block of code to be executed.

3 Coding Style for every programmer

Make sure to always use the same coding style in your projects. Use camelCase for identifier names in variables. It's a good variable name that starts with letters.

For functions :
Put the opening bracket at the end of the first line. Use one space before the opening bracket. Put the closing bracket on a new line, without leading spaces. Do not end a complex statement with a semicolon.

For Object :
Place the opening bracket on the same line as the object name. Use colon plus one space between each property and its value. Use quotes around string values, not around numeric values. Do not add a comma after the last property-value pair. Place the closing bracket on a new line, without leading spaces. Always end an object definition with a semicolon.

4 Comment

JavaScript comments are useful to explain code and to make it more readable.
It can be written two ways single line comment and multi-line comment

5 Arrow Function

We are familiar with arrow functions in ES6. Arrow functions make it easier to write shorter syntax. Modern programmers used to like it. If you check today's date by arrow function to write.

6 Spread Syntax (...)

The spread syntax can be used when all elements from an object or array need to be included in a list of some kind. It is much easier to include all previous items or lists them into a new array or object.

7 `Default Parameters of functions

Sometimes we have a situation where we find undefined value in our output. In JavaScript, default function parameters are solved to initialize named parameters with default values if no values or undefined are passed into the function.

8 JavaScript Hoisting

Variable hoisting plays an important role in programmer life. Actually, a beginner programmer faces too much when writing code. Hoisting is JavaScript's default behavior of moving all declarations to the top of the current scope. the variable can be declared after it has been used. Another side a variable can be used before it has been declared.

9 ES6 Symbol data type

The symbol is a primitive datatype just like Number, String, or Boolean. Symbols are always unique. For instance, if different coders want to add a property to a person object belonging to a third-party code, they could mix each other's values.

10 cross-browser testing

Sometimes a developer needs to test the project on various platforms to check how to run the project. If A developer develops a web application first and needs to test various browsers. If it works well after that it's definitely works for the real world.

Discussion (0)

Forem Open with the Forem app