Node.js Tutorial - Node.js Loop Statement

JavaScript also supports while , do...while , and for loops. loop are also supported in Node.js.


The following code shows that we can get the names of all the keys on an object:

var user = {
     first_name: "CSS",
     last_name: "HTML",
     age: 4,/*from   w w  w. java 2 s  .c  o m*/
     website: ""

for (key in user) {

The code above generates the following result.