Skip to main content

Posts

Showing posts from June, 2021

29/06/2021 TIL

1. PS(BOJ/Programmers) update programmers questions on github  2. Project (DividendDB & OXINION) with JS/React Fundamental of JS course  3. CS for Interview summary interview questions 

Basic input and output of JavaScript(Node.js)

Groom(readline module) const input = require ( 'fs' ) . readFileSync ( '/dev/stdin' ) . toString ( ) . split ( '\n' ) ; BOJ(FS module) // Run by Node.js const readline = require ( "readline" ) ; const rl = readline . createInterface ( { input : process . stdin , output : process . stdout , } ) ; let input = [ ] ; rl . on ( "line" , function ( line ) { // let num = line.split(' ').map(Number); for one line input . push ( line . trim ( ) ) ; // rl.close(); } ) . on ( "close" , function ( ) { const length = parseInt ( input [ 0 ] ) ; const values = input [ 1 ] . split ( " " ) . map ( Number ) ; console . log ( `your length is ${ length } & your arr is ${ values } ` ) ; process . exit ( ) ; } ) ;