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         914  0.5  0.5 1306864 84676 ?       Ssl  Aug04 351:32 node /home/sasa/.pm2/modules/pm2-logrotate/node_modules/pm2-logr
sasa         935  0.7  0.8 11786584 132748 ?     Ssl  Aug04 519:12 node /home/sasa/dex8/dex8-api/starter.js
sasa         938  0.4  0.4 1307036 76076 ?       Ssl  Aug04 299:00 node /home/sasa/regoch/regoch-www/server
sasa         945  0.3  0.3 1295816 63432 ?       Ssl  Aug04 253:51 node /home/sasa/dex8/dex8-panel/server/index.js
sasa         947  0.7  0.6 11833012 113052 ?     Ssl  Aug04 515:46 node /home/sasa/dex8/dex8-www/server/index.js
sasa         966  0.5  0.6 11811792 99000 ?      Ssl  Aug04 391:50 node /home/sasa/mikosoft_hr/www-mikosoft-hr/server/index.js
sasa         980  0.8  0.5 1330216 83524 ?       Ssl  Aug04 539:18 node /home/sasa/mikosoft-info/api-mikosoft-info/starter.js
sasa         997  0.3  0.4 1303104 70944 ?       Ssl  Aug04 256:46 node /home/sasa/mikosoft-info/www-mikosoft-info/server/index.js
sasa        1021  0.3  0.3 1297448 64548 ?       Ssl  Aug04 252:54 node /home/sasa/dex8/dex8-kiosk/server/index.js
sasa        1065  0.6  0.7 11844724 124184 ?     Ssl  Aug04 431:07 node /home/sasa/mikosoft-info/dodo-mikosoft-info/server/index.js
sasa        1074  0.6  0.6 1148752 104352 ?      Ssl  Aug04 420:54 node /home/sasa/voovuu/voovuu-api/starter.js
sasa        1136  0.7  1.0 11868324 170916 ?     Ssl  Aug04 487:41 node /home/sasa/voovuu/voovuu-pub/server/index.js
sasa        1148  0.4  0.4 11794644 78416 ?      Ssl  Aug04 280:28 node /home/sasa/@mikosoft/dodo-examples/server/index.js
sasa        1197  0.3  0.3 1100652 64124 ?       Ssl  Aug04 261:35 node /home/sasa/dex8/dex8-worker/starter.js
sasa        1199  0.4  0.4 22278012 77528 ?      Ssl  Aug04 265:52 node /home/sasa/dex8/dex8-worker/starter.js
sasa        1308  0.3  0.3 1100128 64280 ?       Ssl  Aug04 260:50 node /home/sasa/dex8/dex8-worker/starter.js
sasa        1325  0.3  0.3 1100128 63588 ?       Ssl  Aug04 260:33 node /home/sasa/dex8/dex8-worker/starter.js
sasa        1393  0.8  0.8 22324984 143164 ?     Ssl  Aug04 534:49 node /home/sasa/dex8/dex8-worker/starter.js
sasa        1395  0.3  0.3 1100140 63688 ?       Ssl  Aug04 261:44 node /home/sasa/dex8/dex8-worker/starter.js
sasa        1489  0.3  0.3 1099872 64068 ?       Ssl  Aug04 261:38 node /home/sasa/dex8/dex8-worker/starter.js
sasa        1496  0.3  0.3 1100896 65380 ?       Ssl  Aug04 260:23 node /home/sasa/dex8/dex8-worker/starter.js
sasa        1607  0.3  0.3 1100384 64384 ?       Ssl  Aug04 261:02 node /home/sasa/dex8/dex8-worker/starter.js
sasa        1608  0.3  0.3 1100384 63560 ?       Ssl  Aug04 259:50 node /home/sasa/dex8/dex8-worker/starter.js
sasa        1686  1.7  5.0 12557180 830960 ?     Ssl  Aug04 1156:21 node /home/sasa/mikosoft-info/crypto-mikosoft-info/server/index.
www-data 1066761  0.0  0.0   2608   536 ?        S    07:50   0:00 sh -c ps -aux | grep node
www-data 1066763  0.0  0.0   3304   656 ?        S    07:50   0:00 grep node
sasa     1371685  0.4  0.5 11803196 89488 ?      Ssl  Aug16 216:53 node /home/sasa/mikosoft-info/solar-wind-energy/server/index.js
sasa     1460918  0.4  0.3 1300136 65284 ?       Ssl  Aug17 215:18 node /home/sasa/sites-nodejs/oxygen-free-copper/server.js