JS에서의 primitive JS에서의 primitive value는 객체도 아니고, 메소드도 없는 값이다. JS의 primitive value는 다음과 같다.(ecma2020 기준) string number bigint boolean null undefined symbol 모든 primitive 값은 불변하여 변형할 수 없다. 변수에 값을 할당하는 행위와 값 자체를 혼동하지 않아야 한다! JS에서의 wrapper null과 undefined를 제외하고, 모든 primitive value는 래퍼 객체를 갖는다. String Number BigInt Boolean Symbol const num = 123; const numObj = Number(123); const strObj = String(123); ..
이게 best Practice인지는 모르겠음. const getAjax = function(url) { return new Promise((resolve, reject) => { // 1. $.ajax({ url: url, type: "GET", dataType: "json", data: { ascending: false, max: 20, }, success: (res) => { resolve(res); // 2. }, error: (e) => { reject(e); // 3. } }); }); } $(document).on('click', "#btnId", async () => { // 4. try { const { token, items } = await getAjax(url); // 5. // to..
참고. 전개 구문 - JavaScript | MDN 전개 구문 전개 구문을 사용하면 배열이나 문자열과 같이 반복 가능한 문자를 0개 이상의 인수 (함수로 호출할 경우) 또는 요소 (배열 리터럴의 경우)로 확장하여, 0개 이상의 키-값의 쌍으로 객 developer.mozilla.org 전개 구문(spread syntax)을 활용하면 쉽다. function spreadFunc(...args) { console.log(args); } spreadFunc(); spreadFunc(1); spreadFunc(1, 2, 3); spreadFunc('a', 1, {}); /* 실행 결과 [] [ 1 ] [ 1, 2, 3 ] [ 'a', 1, {} ] */ 매개 변수는 전개 구문과 일반 변수를 혼용할 수 있다. fu..
![](http://i1.daumcdn.net/thumb/C148x148/?fname=https://blog.kakaocdn.net/dn/cgDT3V/btq1Mp6i4Ie/oatk34VaxJnjcWQkAlVS3K/img.png)
참고. airbnbのjavascript eslintで快適WebStorm生活! - Qiita 概要 プライベートなReactNativeアプリ開発、せっかくなので有名どころのコーディングスタイルを試してみようと思い、WebStormへの導入過程をまとめました。 Style選定 好み&決めの問題なので qiita.com // macOS 기준 npm i --g eslint npm i eslint-config-airbnb eslint-plugin-jsx-a11y eslint-plugin-react eslint-plugin-import --save-dev vi .eslintrc.json /* { "extends": "airbnb" } */ preference > eslint 검색시 JavaScript > Code Quality Tool..
[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를 지양합니다. 이는 재할당으로부터 비롯되는 버그, 또는 이해하기 어려운 코드의 사용을 방지해줍니다...
![](http://i1.daumcdn.net/thumb/C148x148/?fname=https://blog.kakaocdn.net/dn/bP2G5D/btq1uvzI6kV/mW5tpYRAjC4EkkaknuKur0/img.jpg)
참고 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..
- Total
- Today
- Yesterday
- AWS
- spring boot
- JEST
- eureka
- Git
- Linux
- Gradle
- JPA
- hashicorp
- Node.js
- IntelliJ
- postgresql
- RancherDesktop
- Spring Cloud Config
- Puppeteer
- AWS IoT
- Docker
- shell
- 코딩테스트
- Vault
- mysql
- terraform
- Java
- jQuery
- javascript
- pgloader
- Database
- etc
- react
- kotlin
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |