js
- Optional chaining (?.) 2024.06.18 js/js syntax
- (Nullish coalescing??: null,undefined일때만) vs (||: falsy-null,undefined,0,'',NaN..) 2024.06.18 js/js syntax
- How to create an array containing 0...N-1: [...Array(N).keys()], Array.from(Array(N).keys()) 2024.04.18 js/js syntax
- [현재시각]new Date(), momet를 쓴다면 moment() = moment(undefined) != moment(null)-Invalid date리턴됨 2024.04.17 js/js date
- [date->string]YYYY-MM-DD: new Date().toISOString().slice(0,10), moment를 쓴다면 moment().format("YYYY-MM-DD") 2024.04.17 js/js date
- [string->date]moment를 쓰면 moment('20240101'), moment('2024-01-02') 모두 가능, 안쓰면 new Date('20240101') 불가능 2024.04.17 js/js date
- [js regex] /^(?=.*[A-Za-z])(?=.*\d)(?=.*[@$!%*#?&])[A-Za-z\d@$!%*#?&]{8,}$/ 8자리이상 문자,숫자,특수문자 포함 2024.04.01 js/js syntax
- [js regex] /^\d{1,7}$/.test('string') 'string'이 1에서7자리 자연수인지 체크 (최대7자리수까지 입력가능하도록 체크) 2024.04.01 js/js syntax
- [numberCheck] /^\d+$/.test(확인대상-문자열, 문자열아니면 문자열로 자동변환) Number.isInteger(확인대상-숫자, 그중에서도 정수만 true 1.0도 true) 2024.04.01 js/js syntax
- Difference between fetch, ajax, and xhr 2024.01.19 js
Optional chaining (?.)
(Nullish coalescing??: null,undefined일때만) vs (||: falsy-null,undefined,0,'',NaN..)
const a = arg||'default' 주로 이렇게 초기화용도로 쓰는데 0, ''도 정상값일 경우는 ??를 쓰면 됨
Nullish coalescing operator
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Nullish_coalescing
Logical or operator
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Logical_OR
'js > js syntax' 카테고리의 다른 글
How to create an array containing 0...N-1: [...Array(N).keys()], Array.from(Array(N).keys())
[...Array(N).keys()]
Array.from(Array(N).keys())
'js > js syntax' 카테고리의 다른 글
[현재시각]new Date(), momet를 쓴다면 moment() = moment(undefined) != moment(null)-Invalid date리턴됨
[date->string]YYYY-MM-DD: new Date().toISOString().slice(0,10), moment를 쓴다면 moment().format("YYYY-MM-DD")
[string->date]moment를 쓰면 moment('20240101'), moment('2024-01-02') 모두 가능, 안쓰면 new Date('20240101') 불가능
[js regex] /^(?=.*[A-Za-z])(?=.*\d)(?=.*[@$!%*#?&])[A-Za-z\d@$!%*#?&]{8,}$/ 8자리이상 문자,숫자,특수문자 포함
'js > js syntax' 카테고리의 다른 글
[js regex] /^\d{1,7}$/.test('string') 'string'이 1에서7자리 자연수인지 체크 (최대7자리수까지 입력가능하도록 체크)
postgreSQL numeric(10,3)이면 숫자가 최대 7자, 소수점 3자리까지 가능
7자리 넘으면 에러 발생, 7자리 체크위해서 regex사용가능
제한없이 숫자만 입력받으려면 {1,7} -> +로 변경
/^\d+$/.test(refCost.current.value)
'js > js syntax' 카테고리의 다른 글
[numberCheck] /^\d+$/.test(확인대상-문자열, 문자열아니면 문자열로 자동변환) Number.isInteger(확인대상-숫자, 그중에서도 정수만 true 1.0도 true)
/^\d+$/.test('123') true
/^\d+$/.test(123) true
/^\d+$/.test(123.0) true -> 123.0을 string으로 변환한후에 체크하는 듯
/^\d+$/.test('123.0') false
/^\d+$/.test('123r') false
Number.isInteger(123) true
Number.isInteger(123.0) true
Number.isInteger(123.1) false
Number.isInteger('123') false
'js > js syntax' 카테고리의 다른 글
[js regex] /^(?=.*[A-Za-z])(?=.*\d)(?=.*[@$!%*#?&])[A-Za-z\d@$!%*#?&]{8,}$/ 8자리이상 문자,숫자,특수문자 포함 (0) | 2024.04.01 |
---|---|
[js regex] /^\d{1,7}$/.test('string') 'string'이 1에서7자리 자연수인지 체크 (최대7자리수까지 입력가능하도록 체크) (0) | 2024.04.01 |
javascript true/false (0) | 2022.08.31 |
js reduce function (0) | 2022.08.22 |
js empty array check: arr?.length===0 (객체이면 arr.length는 undefined) (0) | 2022.07.11 |
Difference between fetch, ajax, and xhr
Difference between fetch, ajax, and xhr
Difference between fetch, ajax, and xhr
What is the difference between these 3 calling methods? I'm using fetch in my current project and don't see any real difference between them. Why does there need to be 30 different ways to do thing...
stackoverflow.com
https://stackoverflow.com/questions/52261136/difference-between-fetch-ajax-and-xhr
Difference between fetch, ajax, and xhr
What is the difference between these 3 calling methods? I'm using fetch in my current project and don't see any real difference between them. Why does there need to be 30 different ways to do thing...
stackoverflow.com
'js' 카테고리의 다른 글
변수의 true/false를 이용한 react 조건부 rendering (0 error case) (0) | 2022.08.31 |
---|---|
csv file download 구현 (0) | 2022.08.18 |
개발환경에 따른 console.log 분리 (0) | 2022.08.17 |
js array 중복제거 (0) | 2022.08.08 |
moment (0) | 2022.07.25 |