• Tutorials Logic, IN
  • +91 8092939553
  • info@tutorialslogic.com

NodeJS Basics

NodeJS Basics

NodeJS is a JavaScript framework, which uses the JavaScript syntax. To learn JavaScript in detail, you can refer to this JavaScript Tutorial. For now, I will quickly explain some of the basic NodeJS concepts, which are given below:-

  • Data Types.
  • Variables.
  • Operators.
  • Functions.

Data Types

Like any other programming language, NodeJS has various datatypes, which are categorized into Primitive and Non-Primitive datatypes.

Primitive Data Types

  • String.
  • Number.
  • Boolean.
  • Null.
  • Undefined.

Non-primitive Data Types

  • Array.
  • Object.
  • Date.

Variables

Variables are the containers in the memory which holds the data value and it can be changed anytime. NodeJS variable can be declare by reserved keyword "var", "let", and "const".

										    
											var name = "Tutorials Logic";
											
										

Operators

An operators are used to perform a mathematical operation on single or multiple operands. NodeJS supports the below operators:-

Operator TypeOperators
Arithmetic+, -, /, *, %, ++, --
Assignment=, +=, -=, *=, /=, %=
Conditional=?
Comparison==, ===, !=, !==, >, >=, <, <=
Logical&&, ||, !
Bitwise&, |, ^, ~, <<, >>, >>>

Functions

Function in NodeJS is a block of code, which is designed to perform any particular task. You need to use the keyword function to create it. A NodeJS function can be executed by calling or invoking it.

										    
											// Defining a NodeJS function
											function sayHello() {
											    console.log("Hello World !");
											};
											
											// Calling a function
											sayHello();