Day-7 Object

So Eun Ahn·2021년 1월 9일
0

JavaScript

목록 보기
11/26

in arrays there is no way to giving each of elements(values) specific names.
cannot reference them by the name, only reference them by the order such as

name[0]

so we use 'OBJECT'

similarities with arrays: objects groups different variables that belong together
difference btw arrays: order of values does not matter when we want to retrieve them

Array : more towards for order data
Object: more unstructured data that need to be named

Object: defines key value pairs
key : variable names = properties

////object literal syntax : literaly writing down entire object content
const sso = {
    firstName: 'Sso',
    lastName: 'Ahn',
    age: 2037 - 1992,
    job: 'director',
    friends: ['Michael', 'Peter', 'Steven']
}; //object sso has 5 properties
ex) property job with the value of director

dot notation : can pull out exact property value of object
bracket notation : can put any expression

맨 하단 구문은 챌린지 였는데 !!풀어냈다 조금 해답과는 달랐지만 그래도 맞추긴해서 행복했다.

profile
오늘도 새로운 도전을 한다

0개의 댓글