NodeJS for non Javascript developer
Learn NodeJS for whom already have some basic programming experience in the different language.
I started learning nodeJS for my work. I was completely new to javascript technology.
I spent some time to learn and willing to share my knowledge. The whole idea of this blog is to gain nodeJS knowledge by spending less time. I tried to make this blog small and more informative.
This is the first and basic part of the nodeJS tutorial.
I assume you have some knowledge of any programming language.
NodeJs can be downloaded from here.
Code editor can be downloaded from here.
Open VS code editor and create a file main.js and type the below line.
console.log(“Hello World!”);
Open the terminal and navigate to the directory where the main.js file is present and run below command.
And the output will be Hello World!.
Now you ran a javascript program through the terminal like a normal application. Isn’t it good?
Let’s start with boring stuff :)
Variables: var is the reserved keyword and it can be used to hold both number and string.
Operator: Various operators can be applied as below.
Comparison and Logical Operators: Most of the operators work the same way as they do in another programming language. Few of them are different from another programming like
1. equal to (==): this will not check the type i.e integer 10 and string “10” are same
2. equal value and equal type (===): this will check the type i.e integer 10 and string “10” are not same
Various Loops: Loops in nodeJS is similar to other programming languages.
1. for loop
2. while loop
3 do while loop
One last boring stuff is the if else.
Let’s jump to some exciting stuff from here.
Function: A set of statements which perform some task.
syntax :
function is a reserved keyword.
Let’s create a simple function in nodeJS that just print something and call this function.
This will print the output of console log.
Similarly, function with some arguments.
And, the function which returns some values.
For Part 2 click here.