Install node.js
It’s easy to install node.js on Windows, just go to node.js official site and download Windows installer, then execute the installer. Congratulations!!! You successfully installed node.js on Windows!!!Continue reading
It’s easy to install node.js on Windows, just go to node.js official site and download Windows installer, then execute the installer. Congratulations!!! You successfully installed node.js on Windows!!!Continue reading
A todo list website is a good practice to learn a programing language or a framework. It shows you how to create
, read
, update
and delete
records. In this post we are going to use Express as our application framework and MongoDB as our data store.
I would like to describe the solutions I want to use before comparing, here’s my ideal solution:
Javascript is an event driven language and this is the most important thing that makes node.js an awesome toolkits. Javascript works like human. For example if there are 5 things to do, they are
Continue reading
What is a callback? A callback is a function to be executed after another function is executed. Sounds tongue-twisted? Normally if you want to call function do_b
after function do_a
the code looks something like
For a long time javascript call
and apply
have been really confusing me. I neither know when to use it nor what are the differences between these two.
Basically call
and apply
invoke the function and switch the function context with the first argument. The main difference between these two is with call
the rest arguments are passed to the calling function and those arguments have to be listed explicitly. However with apply
the amount of arguments don’t have to be predefined. we can pass in an array.
We’ve talked about scopes and closures, this
points to the current scope object. In client side the highest scope is window
and in node.js the highest scope is the global objects.
Javascript is a pretty free language. You can either code in functional programming
style or object oriented programming
style. With functional programming
you pass variables and callbacks around. this
is quite useless. However with OOP
this
is a must.
Javascript uses function as scope. Declare a function inside another function creates a different scope. Let’s look at the example code below.
Continue reading
After setting up n node.js development environment, you need to know some basic commands of node package manager npm
. The followings are the most commonly used ones.
After setting up the node.js development environment and know some common uses of npm
commands. It’s time to learn the basics of javascript and node.js.
Examples and source are available on github