Test JS script file

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

  1. 05define_functions.js
  2. 10module_basic1.js
  3. 10module_basic2.js
  4. 10module_basic3.js
  5. 11module_nesting.js
  6. file.js
  7. fs-async.js
  8. fs-async2.js
  9. fs-async3.js
  10. fs-sync.js
  11. fs-sync2.js
  12. http.js
  13. index.html
  14. index.js
  15. my_modules
  16. net.js
  17. npm-debug.log
  18. package.json
  19. promises
  20. socket.js
  21. sys.js
  22. testfiles

..:: Source code - 05define_functions.js ::..

//classic definition
function fun1() {
	console.log('From fun1');
}


//like a variable definition
var fun2 = function() {
	console.log('From fun2');
}


//like an object
var fun3 = {
	property: function() {
		console.log('From fun3');
	}
}


//outputs
console.log(fun1);
console.log("\n"+fun2);
console.log("\n"+fun3);
 

..:: NodeJS Console - 05define_functions.js ::..

$ node 05define_functions.js
[Function: fun1]

function() {
	console.log('From fun2');
}

[object Object]
$ps -aux | grep node (list all node processes)
sasa        1194  0.5  0.4 1304292 81584 ?       Ssl  Oct24  97:26 node /home/sasa/.pm2/modules/pm2-logrotate/node_modules/pm2-logr
sasa        1200  0.9  0.8 11721368 135840 ?     Ssl  Oct24 175:49 node /home/sasa/dex8/dex8-api/starter.js
sasa        1207  0.4  0.4 1303480 71232 ?       Ssl  Oct24  74:19 node /home/sasa/regoch/regoch-www/server
sasa        1208  0.3  0.4 1304912 72712 ?       Ssl  Oct24  69:32 node /home/sasa/dex8/dex8-panel/server/index.js
sasa        1224  1.0  0.6 11830820 111452 ?     Ssl  Oct24 192:00 node /home/sasa/dex8/dex8-www/server/index.js
sasa        1236  0.5  0.5 11810828 96788 ?      Ssl  Oct24 101:25 node /home/sasa/mikosoft_hr/www-mikosoft-hr/server/index.js
sasa        1255  0.7  0.4 1329104 81768 ?       Ssl  Oct24 133:34 node /home/sasa/mikosoft-info/api-mikosoft-info/starter.js
sasa        1257  0.3  0.4 1298500 66288 ?       Ssl  Oct24  70:29 node /home/sasa/mikosoft-info/www-mikosoft-info/server/index.js
sasa        1289  0.3  0.4 1298452 66520 ?       Ssl  Oct24  69:28 node /home/sasa/dex8/dex8-kiosk/server/index.js
sasa        1292  0.5  0.5 11797508 86652 ?      Ssl  Oct24 109:02 node /home/sasa/mikosoft-info/dodo-mikosoft-info/server/index.js
sasa        1363  2.9  2.7 12143532 444088 ?     Ssl  Oct24 538:49 node /home/sasa/voovuu/voovuu-pub/server/index.js
sasa        1441  0.4  0.4 11794584 78340 ?      Ssl  Oct24  75:04 node /home/sasa/@mikosoft/dodo-examples/server/index.js
sasa        1449  0.3  0.3 1165544 64180 ?       Ssl  Oct24  72:55 node /home/sasa/dex8/dex8-worker/starter.js
sasa        1528  1.9  2.7 22626296 446372 ?     Ssl  Oct24 351:25 node /home/sasa/dex8/dex8-worker/starter.js
sasa        1529  0.3  0.3 1099620 63160 ?       Ssl  Oct24  72:40 node /home/sasa/dex8/dex8-worker/starter.js
sasa        1606  0.3  0.3 1098852 62720 ?       Ssl  Oct24  73:00 node /home/sasa/dex8/dex8-worker/starter.js
sasa        1607  0.3  0.3 1099620 63564 ?       Ssl  Oct24  72:41 node /home/sasa/dex8/dex8-worker/starter.js
sasa        1705  0.3  0.3 1099624 64668 ?       Ssl  Oct24  72:33 node /home/sasa/dex8/dex8-worker/starter.js
sasa        1706  0.3  0.3 1099364 63648 ?       Ssl  Oct24  72:36 node /home/sasa/dex8/dex8-worker/starter.js
sasa        1805  0.3  0.3 1100384 65196 ?       Ssl  Oct24  72:38 node /home/sasa/dex8/dex8-worker/starter.js
sasa        1807  0.3  0.3 1100128 65156 ?       Ssl  Oct24  71:18 node /home/sasa/dex8/dex8-worker/starter.js
sasa        1885  0.3  0.3 1098856 63836 ?       Ssl  Oct24  71:25 node /home/sasa/dex8/dex8-worker/starter.js
sasa        1886  1.1  0.8 11841420 133052 ?     Ssl  Oct24 203:40 node /home/sasa/mikosoft-info/crypto-mikosoft-info/server/index.
sasa     2628167  0.8  0.6 1152976 105108 ?      Ssl  Nov04  19:03 node /home/sasa/voovuu/voovuu-api/starter.js
www-data 3024321  0.0  0.0   2608   528 ?        S    07:11   0:00 sh -c ps -aux | grep node
www-data 3024323  0.0  0.0   3304   652 ?        S    07:11   0:00 grep node