字符串补白:
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,);