반응형
졸업작품_preparing..../node_js2019. 1. 30. 15:15npm 모듈 사용법

이번에는 underscore 라는 모듈을 사용해 볼 것이다 . 모듈 사용에 앞서 , npm init 을 해줌으로써 초기화를 시켜 준다 . 그리고 나서 우리가 사용해볼 , underscore 을 다운받아 준다 . 이 때 , 다운방법 2가지가 있다 . npm install underscorenpm install underscore --save 2가지 차이점은 정확히 모르겠지만 , --save를 해줘야 한다 . 이제 이 모듈을 코드를 통해서 어떻게 사용되는지 알아 본다 . underscore.js var _ = require('underscore');var arr = [1,2,3,4,5]; console.log(arr[0]);console.log(_.first(arr)); console.log(arr[arr...

반응형
image