有一个 person
对象,person
对象含有属性 firstName
、lastName
、 age
,如:
var person = {
firstName: 'Bill',
lastName: 'Gates',
age: 56,
}
请书写一个 print
函数,函数参数为 person
对象,该函数按照如下格式进行打印:
{firstName} {lastName}'s age is {age}
例如:
参数 person
对象为:
var person = {
firstName: 'Bill',
lastName: 'Gates',
age: 56,
}
打印结果应该为: Bill Gates's age is 56
function print(person) {
// write your code here...
}
var bill = {
firstName: 'Bill',
lastName: 'Gates',
age: 56,
};
print(bill); // 打印 Bill Gates's age is 56
对象取值
字符串拼接
打印