es8(字符串,对象
字符串补白:
let str = "abc";
let a = str.padEnd(5);
let b = str.padStart(5);
let c = str.padEnd(5,"a");
let d = str.padStart(5,"a");
console.log("|"+str+"|");//显示|abc|
console.log("|"+a+"|");//显示|abc |
console.log("|"+b+"|");//显示| abc|
console.log("|"+c+"|");//显示|abcaa|
console.log("|"+d+"|");//显示|aaabc|
对象:
let obj = {
name:"曹伟",
age:23
};
let arr = ["a","b"];
console.log(Object.values(obj));//显示["曹伟", 23]
console.log(Object.values(arr));//显示["a", "b"]
console.log(Object.entries(obj));//显示[Array(2), Array(2)]
函数对象的定义调用时参数可以加入尾逗号:
function fn(a,b){
console.log(123);
}
fn(1,2,);