Nodejs

 

 

 

 

 

 

 

 

var names =['소녀시대', '걸스데이', '티아라'];

var users=[{name:'소녀시대', age :20}, {name:'걸스데이', age:22}];

users.push({name:'티아라', age:21});

console.log('사용자 수 : ' + users.length);
console.log('첫번째  사용자 이름 : '+ users[0].name) ;


 

사용자 수 : 3

첫번째 사용자 이름  : 소녀시대

 

var users =[{name:'소녀시대', age:20}, {name:'걸스데이', age:22}];
var oper =function(a, b){
    return a+b;  
};

users.push(oper);
console.dir(users);
console.log('세번째 배열 요소를 함수로 실행 : ' + users[2](10,10) );

 

Command: node "C:/Program Files (x86)/Brackets/www/macaronics/ch03_test9.js"

Working directory: C:/Program Files (x86)/Brackets/www/macaronics/

[ { name: '소녀시대', age: 20 },

{ name: '걸스데이', age: 22 },

[Function: oper] ]

세번째 배열 요소를 함수로 실행 : 20

Program exited with code 0

 

 

 

 

 

 

 

 

about author

PHRASE

Level 60  라이트

사람의 눈은 그가 현재 어떻다 하는 인품을 말하고, 사람의 입은 그가 무엇이 될 것인가 하는 가능성을 말한다. -고리키

댓글 ( 4)

댓글 남기기

작성

Nodejs 목록    more