How to use Array in node.js? -


i have make cryptograph using node.js on tonight. have tried can't.

what wrong ? help!!!

function encrypt(data,j) {     for(var = 0, length = data.length; i<length; i++) {          j = data.charcodeat(i);         //console.log(j);         string.fromcharcode(j);         process.stdout.write(j);     }     return j; }  function decrypt(data) {     return data; }  process.stdin.resume(); process.stdin.setencoding('utf-8');  process.stdout.write('암호화할 문장을 입력(input) : ' );  process.stdin.on('data',function(data,j) {     //data = data.trim();     process.stdout.write('평문 (uncoded) :' + data);     process.stdout.write('암호문(encrypt) :');     encrypt();     process.stdout.write('복호문(decrypt) :');      process.exit(1);     }); 

microsoft windows [version 6.2.9200] (c) 2007 microsoft corporation. rights reserved.  c:\users\minji>cd ..  c:\users>cd ..  c:\>cd workspace  c:\workspace>node 3112minji  암호화할 문장을 입력(input) : abc  평문 (uncoded) :abc  암호문(encrypt) :  c:\workspace\3112minji.js:2          for(var = 0, length = data.length; i<length; i++) {                                     ^ typeerror: cannot read property 'length' of undefined      @ encrypt (c:\workspace\3112minji.js:2:30)      @ readstream.<anonymous> (c:\workspace\3112minji.js:24:2)      @ readstream.eventemitter.emit (events.js:95:17)      @ readstream.<anonymous> (_stream_readable.js:720:14)      @ readstream.eventemitter.emit (events.js:92:17)      @ emitreadable_ (_stream_readable.js:392:10)      @ emitreadable (_stream_readable.js:388:5)      @ readableaddchunk (_stream_readable.js:150:9)      @ readstream.readable.push (_stream_readable.js:113:10)      @ tty.onread (net.js:511:21)   c:\workspace> 

you never pass encrypt method, when tries access data crashes.

encrypt(data, j);


Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

javascript - jQuery .height() return 0 when visible but non-0 when hidden -