표기법
dach-case(kebab-case)
단어와 단어 사이에 -(dash)로 묶어서 사용
html/css에서 많이 사용
snakecase
단어와 단어 사이에 (언더바)로 묶어서 사용
html/css에서 많이 사용
camelCase
첫글자가 소문자이고 다음부터 오는 단어는 대문자로 시작하여 오는 단어
js에서 주로 사용하는 표기법
PascalCase
첫번쨰 단어부터도 첫번째 글자를 대문자로 넣어주는 단어
new 생성자 사용 시 사용
거의 대부분 js에서는 camelCase를 사용하시면 됩니다.
zero-based numbering
0 기반 번호 매기기
특수한 경우를 제외하고 0부터 숫자를 시작합니다.
let fruits = ['Apple', 'Banana', 'Cherry']
console.log(fruits[0]) // 'Apple'
console.log(fruits[1]) // 'Banana'
console.log(fruits[2]) // 'Cherry'
console.log(new Date('2021-01-30').getDay()) // 6, 토요일
console.log(new Date('2021-01-31').getDay()) // 0, 일요일
console.log(new Date('2021-02-01').getDay()) // 1, 월요일
주석 Comments
// 한 줄 메모
/* 한 줄 메모 */
/**
* 여러 줄
* 메모1
* 메모2
*/
데이터 종류(자료형)
string
// String(문자 데이터)
// 따옴표를 사용합니다.
let name = "Grace"
let email = 'nej1044@namver.com'
let hello = `Hello ${name}?!`
console.log(name) // Grace
console.log(email) // nej1044@naver.com
console.log(hello) // Hello Grace?!
number
// Number(숫자 데이터)
// 정수 및 부동소수점 숫자를 나타냅니다
let number = 123
let opacity = 1.57
console.log(number) // 123
console.log(opacity) // 1.57
boolean
// Boolean(불린 데이터)
// true, false 두 가지 값 밖에 없는 논리 데이터입니다.
let checked = true;
let isShow = false
console.log(checked) // true
console.log(isShow) // false
undefined
// Undefined
// 값이 할당되지 않은 상태를 나타냅니다.
let undef;
let obj = {abc: 123}
console.log(undef) // Undefined
console.log(obj.abc) // 123
console.log(obj.xyz) // Undefined
null
// Null
// 어떤 값이 의도적으로 비어있음을 의미합니다.
let empty = null
console.log(empty) // null
object
// Object(객체 데이터)
// 여러 데이터를 Key:Value 형태로 저장합니다. {}
let user = {
// Key: Value,
name: 'Grace',
age: 28,
isValid: true
}
console.log(user.name) // Grace
console.log(user.age) // 28
console.log(user.isValid) // true
array
// Array(배열 데이터)
// 여러 데이터를 순차적으로 저장합니다. []
let fruits = ['Apple', 'Banana', 'Cherry']
console.log(fruits[0]) // Apple
console.log(fruits[1]) // Banana
console.log(fruits[2]) // Cherry
thanks for sharing! Connections Game