Test JS script file

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

  1. 01fun_definition.js
  2. 02fun_parameter_var.js
  3. 03fun_parameter_callback.js
  4. 03fun_parameter_callback2.js
  5. 03fun_parameter_callback3.js
  6. 05fun_var_in_global_scope.js
  7. 06fun_global_var_in_function.js
  8. 07fun_global_var_in_callback.js

..:: Source code - 02fun_parameter_var.js ::..

/**
 * Function parameters
 */


//define function
function fja(p1, p2) { //NodeJS dont support p2=3, browser support
	res = p1 + p2;
	return res;
}

//call function
var x=2, y=3;
var res = fja(x, y);


console.log(res); //5
 

..:: NodeJS Console - 02fun_parameter_var.js ::..

$ node 02fun_parameter_var.js
5
$ps -aux | grep node (list all node processes)
sasa        1194  0.5  0.4 1304100 81420 ?       Ssl  Oct24 271:57 node /home/sasa/.pm2/modules/pm2-logrotate/node_modules/pm2-logr
sasa        1200  0.9  0.8 11723120 138816 ?     Ssl  Oct24 476:50 node /home/sasa/dex8/dex8-api/starter.js
sasa        1207  0.4  0.4 1304396 73376 ?       Ssl  Oct24 223:52 node /home/sasa/regoch/regoch-www/server
sasa        1208  0.3  0.4 1304912 72812 ?       Ssl  Oct24 194:59 node /home/sasa/dex8/dex8-panel/server/index.js
sasa        1224  0.9  0.6 11813300 98688 ?      Ssl  Oct24 470:02 node /home/sasa/dex8/dex8-www/server/index.js
sasa        1236  0.5  0.5 11811596 96136 ?      Ssl  Oct24 298:32 node /home/sasa/mikosoft_hr/www-mikosoft-hr/server/index.js
sasa        1255  0.7  0.5 1330860 84656 ?       Ssl  Oct24 399:49 node /home/sasa/mikosoft-info/api-mikosoft-info/starter.js
sasa        1257  0.3  0.4 1301028 69108 ?       Ssl  Oct24 198:09 node /home/sasa/mikosoft-info/www-mikosoft-info/server/index.js
sasa        1289  0.3  0.4 1297724 67736 ?       Ssl  Oct24 195:25 node /home/sasa/dex8/dex8-kiosk/server/index.js
sasa        1363  3.1  2.8 12155764 465308 ?     Ssl  Oct24 1664:33 node /home/sasa/voovuu/voovuu-pub/server/index.js
sasa        1449  0.3  0.3 1166824 64772 ?       Ssl  Oct24 204:48 node /home/sasa/dex8/dex8-worker/starter.js
sasa        1528  1.7  2.6 33114568 440672 ?     Ssl  Oct24 907:22 node /home/sasa/dex8/dex8-worker/starter.js
sasa        1529  0.3  0.3 1100644 64840 ?       Ssl  Oct24 204:38 node /home/sasa/dex8/dex8-worker/starter.js
sasa        1606  0.3  0.3 1100132 64228 ?       Ssl  Oct24 204:41 node /home/sasa/dex8/dex8-worker/starter.js
sasa        1607  0.3  0.3 1100900 64872 ?       Ssl  Oct24 204:05 node /home/sasa/dex8/dex8-worker/starter.js
sasa        1705  0.3  0.3 1101416 65200 ?       Ssl  Oct24 204:01 node /home/sasa/dex8/dex8-worker/starter.js
sasa        1706  0.3  0.3 1101412 65228 ?       Ssl  Oct24 203:56 node /home/sasa/dex8/dex8-worker/starter.js
sasa        1805  0.3  0.4 1167200 65948 ?       Ssl  Oct24 204:10 node /home/sasa/dex8/dex8-worker/starter.js
sasa        1807  0.3  0.3 1100384 64416 ?       Ssl  Oct24 200:01 node /home/sasa/dex8/dex8-worker/starter.js
sasa        1885  0.3  0.3 1099624 64148 ?       Ssl  Oct24 201:21 node /home/sasa/dex8/dex8-worker/starter.js
sasa        1886  1.6  0.9 11858512 162344 ?     Ssl  Oct24 871:33 node /home/sasa/mikosoft-info/crypto-mikosoft-info/server/index.
sasa     2628167  0.8  0.7 1170068 126496 ?      Ssl  Nov04 301:33 node /home/sasa/voovuu/voovuu-api/starter.js
sasa     3168557  0.6  0.6 11823564 99056 ?      Ssl  Nov06 214:18 node /home/sasa/mikosoft-info/dodo-mikosoft-info/server/index.js
sasa     3169051  0.4  0.5 11798408 83044 ?      Ssl  Nov06 139:57 node /home/sasa/@mikosoft/dodo-examples/server/index.js
www-data 3741605  0.0  0.0   2608   596 ?        S    19:17   0:00 sh -c ps -aux | grep node
www-data 3741607  0.0  0.0   3304   652 ?        S    19:17   0:00 grep node