[JS] Airbnb 스타일 가이드 1 - 8. 참고 airbnb/javascript JavaScript Style Guide. Contribute to airbnb/javascript development by creating an account on GitHub. github.com 더 사용이 잦을 것으로 보이는 항목부터 실습하였음. 아래의 내용.. ingnoh.tistory.com 특정한 객체 프로퍼티를 변수에 할당하고자 하는 경우, 나는 습관적으로 다음과 같이 작성하곤 했다. let obj = { title: 'ingnoh', description: 'code monkey', } // 중략... let title = obj.title; let description = obj.description;..
참고용 const str = "i am ingnoh hong"; const chars = str.split(''); /* const chars = Array.from(str); Array.from을 사용할 수도 있다. */ /* const chars = [...str]; 전개연산자를 사용할 수도 있다. 추천함! */ const terms = str.split(' '); // 글자 단위 배열 console.log(chars); // 단어 단위 배열 console.log(terms); /* 실행 결과 [ 'i', ' ', 'a', 'm', ' ', 'i', 'n', 'g', 'n', 'o', 'h', ' ', 'h', 'o', 'n', 'g' ] [ 'i', 'am', 'ingnoh', 'hong' ] */
참고 airbnb/javascript JavaScript Style Guide. Contribute to airbnb/javascript development by creating an account on GitHub. github.com 더 사용이 잦을 것으로 보이는 항목부터 실습하였음. 아래의 내용은 '모든 JS 개발자가 이렇게 한다!'가 아닌 Airbnb의 작성 가이드를 repl.it에서 따라한 결과(안 따라한 것도 많음) 적절히 참고할 것 :D 1. Types Use const for all of your references; avoid using var. 모든 참조는 const를 사용하고, var를 지양합니다. 이는 재할당으로부터 비롯되는 버그, 또는 이해하기 어려운 코드의 사용을 방지해줍니다...
참고 airbnb/javascript JavaScript Style Guide. Contribute to airbnb/javascript development by creating an account on GitHub. github.com 더 사용이 잦을 것으로 보이는 항목부터 실습하였음. 아래의 내용은 '모든 JS 개발자가 이렇게 한다!'가 아닌 Airbnb의 작성 가이드를 repl.it에서 따라한 결과(다 해보진 않음) 적절히 참고할 것 :D 12. Properties Use dot notation when accessing properties. property에 접근할 때는 온점(.)을 사용합니다. const luke = { jedi: true, age: 28, }; // bad const isJe..
참고 Array.prototype.some() - JavaScript | MDN Array.prototype.some() some() 메서드는 배열 안의 어떤 요소라도 주어진 판별 함수를 통과하는지 테스트합니다. 참고: 빈 배열에서 호출하면 무조건 false를 반환합니다. The source for this interactive example i developer.mozilla.org some은 배열 안의 어떤 요소라도 주어진 함수를 통과하는지 확인한다. 하나라도 충족할 경우 true를 반환한다. 빈 배열에서 호출시 항상 false라고 함! some은 매개변수로 주어진 callback이 true를 반환하는지 확인하기 위해 배열 각 요소를 순회하며 callback을 수행한다. 참인 요소를 발견한 경우 tr..
참고 : Array.prototype.reduce() - JavaScript | MDN Array.prototype.reduce() reduce() 메서드는 배열의 각 요소에 대해 주어진 리듀서(reducer) 함수를 실행하고, 하나의 결과값을 반환합니다. The source for this interactive example is stored in a GitHub repository. If you'd developer.mozilla.org Array.prototype.reduce() => 이하 reduce라고 지칭. reduce() 메서드는 배열의 각 요소에 대해 주어진 함수(= reducer)를 실행하고, 단 하나의 결과값을 반환한다. 예를 들어, let res = arr.reduce(reducer,..
# vi main.js const url = require('url'); const http = require('http'); const app = http.createServer((req, res) => { const _url = req.url; const queryData = url.parse(_url, true); console.log(queryData); let msg = ''; switch(_url) { case '/': msg = 'hello world! :D'; break; default: msg = 'bye world ;('; break; } res.writeHead(200); res.end(msg); }); app.listen(8081); 실행은 node main.js 접속은 브라우저를 ..
참고 Object prototypes - Web 개발 학습하기 | MDN Object prototypes Javascript에서는 객체를 상속하기 위하여 프로토타입이라는 방식을 사용합니다. 본 문서에서는 프로토타입 체인이 동작하는 방식을 설명하고 이미 존재하는 생성자에 메소드를 추 developer.mozilla.org JS에서는 객체 상속을 위해 프로토타입 방식을 사용한다. JS는 흔히 Prototype-based language라고 하며, 이는 곧 모든 객체들이 메소드와 속성들을 상속받기 위한 템플릿 역할을 맡는 'prototype object'를 갖는다는 의미가 된다. Prototype은 자신 또한 프로토타입을 두어 해당 프로토타입의 메소드와 속성을 상속받을 수도 있으며, 이러한 연결 관계를 pro..
- Total
- Today
- Yesterday
- Vault
- AWS
- Linux
- spring boot
- JEST
- pgloader
- Gradle
- RancherDesktop
- kotlin
- Node.js
- jQuery
- Database
- terraform
- etc
- javascript
- Java
- AWS IoT
- 코딩테스트
- Puppeteer
- hashicorp
- Docker
- react
- shell
- Git
- eureka
- JPA
- IntelliJ
- postgresql
- mysql
- Spring Cloud Config
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 |