본문 바로가기
공부/Front-End

[JavaScript #01] Object

by 혼밥맨 2020. 12. 13.
반응형

[JavaScript #01] Object

1
2
3
4
5
6
7
8
let collegeStudent = {
    name: 'John';
    age: 23;
    major: ComputerScience;
    minor: Management;
};

console.log(collegeStudent.age);

We just created an object named 'collegeStudent.' It has four different properties; name, age, major, and minor. At line 8, its code will print out "23" as an integer type. We will look further later when we deeply get into Object-Oriented.

 

 

 

Here is a different example of JavaScript Object example.

1
2
3
4
5
6
7
8
let soccerPlayer = {
    name: 'Son';
    backNumber: 7;
    team: South_Korea_National_Team;
    height(cm): 181;
    weight(lb): 130;
    position: Midfielder;
};

Its object name is soccerPlayer, and it has six different properties. 

 

반응형

댓글