Cute Happy Ghost
본문 바로가기
728x90
SMALL

Front/Javascript·Jquery32

20201113_ 35 노드2 index.html 이게되나? 서버에서 정보받기 아이디 이름 데이터 시간 index.js //express 프레임워크 임포트 const express = require("express") const app = express() const PORT = 6600//포트 번호 //미들웨어 추가 app.use(express.static('./static')) //더미 데이터 //경로 : /data //요청 HTTP 메서드 : GET app.get('/data', (req, res) => { const data = { id: '124125125', name: 'Chiho Won', myData: [1, 2, 3, ], timestamp: new Date(), } // data 객체를 json으로 서빙해줌 // J.. 2020. 11. 13.
20201113_ 35 클로저.. function sayHelloTo(name) { const message = `Hello ${name}!` return function (){ console.log(message) } } const hello1 = sayHelloTo('chiho won') const hello2 = sayHelloTo('test') const hello3 = sayHelloTo('asdf') hello1() hello2() hello3() Hello chiho won! Hello test! Hello asdf!​ function countdown(startAt) { let data = startAt; function counter() { console.log(data--) } return counter } const .. 2020. 11. 13.
20201113_35 노드생성 web이라는 하위폴더생성 web으로 이동해서 npm init해줌 PS C:\Users\wotjd\Frontend> cd 20201113 PS C:\Users\wotjd\Frontend\20201113> cd web PS C:\Users\wotjd\Frontend\20201113\web> npm init This utility will walk you through creating a package.json file. It only covers the most common items, and tries to guess sensible defaults. See `npm help init` for definitive documentation on these fields and exactly what they .. 2020. 11. 13.
20201112_ 34 기본 click dom에서 btn-alert라는 id의 dom을 찾음 btn.addEventListener('click', onClickHandler); function onClickHandler() { alert('마우스 클릭!!'); } 람다식에 익숙치 않으면. 이게 더 이해간다고 var name; //함수레벨 스코프 let name1 = 'abc'; //변수 선언 방법 const name2 = 'abc'; //final (변경 불가능 - 상수) //선언 - 식별자를 등록 //초기화단계 - 값을 위한 공간을 할당하고 식별자랑 연결함.초기화 하지않았다면 undefined console.log(name1); console.log(name2); //식별자(identifier) //변수 //함수 //클래스 //식.. 2020. 11. 12.
728x90
LIST