Test JS script file

Selected file: 02callback_settimeout.js
Compare console.log() outputs in browser and NodeJS.
Notice: Open browser's console in FireBUG!

  1. 01callback.js
  2. 02callback_settimeout.js
  3. 02callback_settimeout2.js
  4. 50bluebird_basic.js
  5. 50bluebird_newPromise.js
  6. 51bluebird_fs.js

..:: Source code - 02callback_settimeout.js ::..

/**
 * callback example which shows that all 3 functions runs in paralel
 */

console.log('BEFORE CALLBACK');

setTimeout(function () {
  console.log('inside callback');
}, 3000);

console.log('AFTER CALLBACK');


/* $node 02callback_settimeout
BEFORE CALLBACK
AFTER CALLBACK
inside callback
 */
 

..:: NodeJS Console - 02callback_settimeout.js ::..

$ node 02callback_settimeout.js
BEFORE CALLBACK
AFTER CALLBACK
inside callback
$ps -aux | grep node (list all node processes)
sasa         849  0.5  0.5 1319680 88452 ?       Ssl  Oct08 283:34 node /home/sasa/regoch/regoch-www/server
sasa         880  0.4  0.5 1319240 87384 ?       Ssl  Oct08 236:00 node /home/sasa/dex8/dex8-www/server/index.js
sasa         890  0.5  0.5 11797800 85496 ?      Ssl  Oct08 334:52 node /home/sasa/mikosoft_hr/www-mikosoft-hr/server/index.js
sasa         903  0.7  0.5 1329652 82276 ?       Ssl  Oct08 431:32 node /home/sasa/mikosoft-info/api-mikosoft-info/starter.js
sasa         929  0.4  0.4 1300184 69240 ?       Ssl  Oct08 226:32 node /home/sasa/mikosoft-info/www-mikosoft-info/server/index.js
sasa         943  0.4  0.4 1300808 66380 ?       Ssl  Oct08 233:39 node /home/sasa/dex8/dex8-kiosk/server/index.js
sasa         980  0.6  0.4 11795444 81740 ?      Ssl  Oct08 365:07 node /home/sasa/mikosoft-info/dodo-mikosoft-info/server/index.js
sasa         981  0.7  0.6 1148036 104540 ?      Ssl  Oct08 395:30 node /home/sasa/voovuu/voovuu-api/starter.js
sasa        1039  0.9  1.4 11953972 245540 ?     Ssl  Oct08 555:36 node /home/sasa/voovuu/voovuu-pub/server/index.js
sasa     2044488  0.3  0.4 1298112 66764 ?       Ssl  Nov01  77:38 node /home/sasa/dex8/dex8-panel/server/index.js
sasa     2574087  0.3  0.4 11792920 77204 ?      Ssl  Nov08  42:15 node /home/sasa/@mikosoft/dodo-examples/server/index.js
sasa     2702010  0.4  0.6 22296696 99792 ?      Ssl  Nov10  35:26 node /home/sasa/dex8/dex8-worker/starter.js
sasa     2702011  0.3  0.4 1100532 67140 ?       Ssl  Nov10  31:33 node /home/sasa/dex8/dex8-worker/starter.js
sasa     2702018  0.3  0.3 1100396 65428 ?       Ssl  Nov10  31:35 node /home/sasa/dex8/dex8-worker/starter.js
sasa     2702019  0.3  0.4 1100516 67136 ?       Ssl  Nov10  31:34 node /home/sasa/dex8/dex8-worker/starter.js
sasa     2702046  0.9  0.7 22311780 124044 ?     Ssl  Nov10  84:41 node /home/sasa/dex8/dex8-worker/starter.js
sasa     2702047  0.3  0.4 1100516 65668 ?       Ssl  Nov10  31:51 node /home/sasa/dex8/dex8-worker/starter.js
sasa     2702088  0.3  0.4 1100520 66172 ?       Ssl  Nov10  31:35 node /home/sasa/dex8/dex8-worker/starter.js
sasa     2702089  0.3  0.4 1100776 66728 ?       Ssl  Nov10  31:32 node /home/sasa/dex8/dex8-worker/starter.js
sasa     2702137  0.3  0.4 1099864 65820 ?       Ssl  Nov10  31:23 node /home/sasa/dex8/dex8-worker/starter.js
sasa     2702139  0.4  0.6 22297196 101408 ?     Ssl  Nov10  35:56 node /home/sasa/dex8/dex8-worker/starter.js
sasa     3097623  1.1  0.8 11716736 131192 ?     Ssl  Nov13  44:38 node /home/sasa/dex8/dex8-api/starter.js
www-data 3370554  0.0  0.0   2608   596 ?        S    09:54   0:00 sh -c ps -aux | grep node
www-data 3370556  0.0  0.0   3304   720 ?        S    09:54   0:00 grep node