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 1306672 83864 ?       Ssl  Aug04 312:19 node /home/sasa/.pm2/modules/pm2-logrotate/node_modules/pm2-logr
sasa         935  0.7  0.8 11786840 132624 ?     Ssl  Aug04 462:41 node /home/sasa/dex8/dex8-api/starter.js
sasa         938  0.4  0.4 1307036 76024 ?       Ssl  Aug04 263:07 node /home/sasa/regoch/regoch-www/server
sasa         945  0.3  0.4 1303752 71480 ?       Ssl  Aug04 225:58 node /home/sasa/dex8/dex8-panel/server/index.js
sasa         947  0.7  0.6 11818788 105904 ?     Ssl  Aug04 462:14 node /home/sasa/dex8/dex8-www/server/index.js
sasa         966  0.5  0.5 11808976 97356 ?      Ssl  Aug04 347:35 node /home/sasa/mikosoft_hr/www-mikosoft-hr/server/index.js
sasa         980  0.7  0.5 1330216 83508 ?       Ssl  Aug04 473:47 node /home/sasa/mikosoft-info/api-mikosoft-info/starter.js
sasa         997  0.3  0.4 1303104 72320 ?       Ssl  Aug04 228:14 node /home/sasa/mikosoft-info/www-mikosoft-info/server/index.js
sasa        1021  0.3  0.3 1297920 65360 ?       Ssl  Aug04 225:03 node /home/sasa/dex8/dex8-kiosk/server/index.js
sasa        1065  0.6  0.5 11812960 96960 ?      Ssl  Aug04 382:22 node /home/sasa/mikosoft-info/dodo-mikosoft-info/server/index.js
sasa        1074  0.6  0.6 1149316 103524 ?      Ssl  Aug04 373:48 node /home/sasa/voovuu/voovuu-api/starter.js
sasa        1136  0.7  0.9 11859876 160644 ?     Ssl  Aug04 435:20 node /home/sasa/voovuu/voovuu-pub/server/index.js
sasa        1148  0.4  0.4 11794644 78272 ?      Ssl  Aug04 248:59 node /home/sasa/@mikosoft/dodo-examples/server/index.js
sasa        1197  0.3  0.3 1099884 63208 ?       Ssl  Aug04 232:37 node /home/sasa/dex8/dex8-worker/starter.js
sasa        1199  0.3  0.4 22277756 77984 ?      Ssl  Aug04 235:57 node /home/sasa/dex8/dex8-worker/starter.js
sasa        1308  0.3  0.3 1099616 63800 ?       Ssl  Aug04 231:55 node /home/sasa/dex8/dex8-worker/starter.js
sasa        1325  0.3  0.3 1099360 63244 ?       Ssl  Aug04 231:46 node /home/sasa/dex8/dex8-worker/starter.js
sasa        1393  0.7  0.8 22326244 146320 ?     Ssl  Aug04 478:21 node /home/sasa/dex8/dex8-worker/starter.js
sasa        1395  0.3  0.3 1099884 63396 ?       Ssl  Aug04 232:53 node /home/sasa/dex8/dex8-worker/starter.js
sasa        1489  0.3  0.3 1100128 63168 ?       Ssl  Aug04 232:49 node /home/sasa/dex8/dex8-worker/starter.js
sasa        1496  0.3  0.3 1100384 64400 ?       Ssl  Aug04 231:36 node /home/sasa/dex8/dex8-worker/starter.js
sasa        1607  0.3  0.3 1099872 63304 ?       Ssl  Aug04 232:09 node /home/sasa/dex8/dex8-worker/starter.js
sasa        1608  0.3  0.3 1099872 63608 ?       Ssl  Aug04 231:02 node /home/sasa/dex8/dex8-worker/starter.js
sasa        1686  1.1  0.8 11846976 147280 ?     Ssl  Aug04 684:40 node /home/sasa/mikosoft-info/crypto-mikosoft-info/server/index.
www-data  616820  0.0  0.0   2608   524 ?        S    17:07   0:00 sh -c ps -aux | grep node
www-data  616822  0.0  0.0   3304   652 ?        S    17:07   0:00 grep node
sasa     1371685  0.4  0.5 11803816 89544 ?      Ssl  Aug16 186:05 node /home/sasa/mikosoft-info/solar-wind-energy/server/index.js
sasa     1460918  0.4  0.3 1300136 64776 ?       Ssl  Aug17 183:44 node /home/sasa/sites-nodejs/oxygen-free-copper/server.js