모듈 내보내기
모듈 가져오기
0 이상 1미만 의 랜덤한 숫자 (소수점)
정수로 변환
길이
중복된 항목 찾기 중복되면 true, 중복 없으면 false반환
배열을 문자열로 바꿔줌
Array(배열 인지) 아그미터 의 변수에 따라 배열 타입이면 true, 아니면 false
문자열을 일정하게 반복
'1'문자열을 3번반복.repeat()
new 키워드사용 (생성자)
class 로 객체 공장을 만든다
객체, 함수, 인스턴스의 이름을 지정할 때 camelCase를 사용하세요. 에스린트:camelcase
camelcase - ESLint - Pluggable JavaScript Linter
A pluggable and configurable linter tool for identifying and reporting on patterns in JavaScript. Maintain your code quality with ease.
eslint.org
// bad
const OBJEcttsssss = {};
const this_is_my_object = {};
function c() {}
// good
const thisIsMyObject = {};
function thisIsMyFunction() {}
생성자나 클래스의 이름을 지정할 때만 PascalCase를 사용하세요. 에스린트:new-cap
new-cap - ESLint - Pluggable JavaScript Linter
A pluggable and configurable linter tool for identifying and reporting on patterns in JavaScript. Maintain your code quality with ease.
eslint.org
// bad
function user(options) {
this.name = options.name;
}
const bad = new user({
name: 'nope',
});
// good
class User {
constructor(options) {
this.name = options.name;
}
}
const good = new User({
name: 'yup',
});
상수는 SNAKE_CASE 사용
// bad
const firefox = 1;
const is_left = true;
// good
const FIREFOX = 1;
const IS_LEFT = true;
'javaScript' 카테고리의 다른 글
| JavaScript 숙제 (0) | 2023.10.25 |
|---|---|
| 조건부 연산자(삼항 연산자) 중첩 (1) | 2023.10.25 |
| 배열 매소드(array methods) (0) | 2023.10.20 |
| 함수(function) (0) | 2023.10.18 |
| 타입 변환 (1) | 2023.10.18 |