라벨이 Error_JavaScript인 게시물 표시

JavaScript Error - module.exports_1

이미지
const express = require ( 'express' ); const router = express . Router (); // Router를 쓰기 위해서 필요 const members = require ( '../../Members' ); // app은 router로 변경 console . log ( 'err1' ); // Gets All Members router . get ( '/' , ( req , res ) => { console . log ( '/api/members' ); res . json ( members ); }); console . log ( 'err2' ); // Get Single Member router . get ( '/:id' , ( req , res ) => { console . log ( 'err3' ); // res.send(req.params.id); const found = members . some ( member => member . id === parseInt ( req . params . id )) if ( found ){ console . log ( 'err4' ); res . json ( members . filter (( mem , idx ) => { return mem . id === parseInt ( req . params . id ); })) } else { console . log ( 'err5' ); res . status ( 400 ). json ({ msg : `No member with the id of ${ req . params . id }...

JavaScript Error - concat_1

이미지
There was an Error message while entering to recursive function. Error Message : Uncaught TypeError : reverse(...).concat is not a function In this case, I want to build an array by using a concat function. But there was an error. So I have to find out what's the problems. first I have to find which variable is coming in front of the concat. It has to be an array. When I check the base, it wasn't. it was a number. So I switch to an array. function   reverse ( arr ) {      const   head  =  arr [ 0 ];      if ( arr . length  ===  1 ){        return   arr [ 0 ];  // Error     }      else   if ( arr . length  >  1 ){        return   reverse ( arr . slice ( 1 )). concat ( arr [ 0 ]);     }        }    function   revers...